-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed dehash file error not outputting correct pairs. added check dis…
…k space.
- Loading branch information
1 parent
993bffe
commit 00eec14
Showing
6 changed files
with
205 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package Models | ||
|
||
import ( | ||
"bufio" | ||
"crypto/md5" | ||
"crypto/sha1" | ||
"crypto/sha256" | ||
"crypto/sha512" | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func CalculateFileHashSizes(file *os.File) (int, int, int, int, int) { | ||
scanner := bufio.NewScanner(file) | ||
lineCount := 0 | ||
|
||
for scanner.Scan() { | ||
lineCount++ | ||
} | ||
|
||
if err := scanner.Err(); err != nil { | ||
fmt.Println("Error reading file:", err) | ||
return 0, 0, 0, 0, 0 | ||
} | ||
|
||
file.Seek(0, 0) | ||
|
||
md4Size := lineCount * md5.Size // MD4 is roughly the same size as MD5 | ||
md5Size := lineCount * md5.Size | ||
sha1Size := lineCount * sha1.Size | ||
sha256Size := lineCount * sha256.Size | ||
sha512Size := lineCount * sha512.Size | ||
|
||
return md4Size, md5Size, sha1Size, sha256Size, sha512Size | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import ( | |
"database/sql" | ||
|
||
_ "modernc.org/sqlite" | ||
|
||
) | ||
|
||
var DB *sql.DB | ||
var DB *sql.DB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.