Commit b00dc948 authored by Ajit Jagtap's avatar Ajit Jagtap
Browse files

Merge branch 'GetAttributeBasedHash' into 'master'

GetAttributeBasedHash added

See merge request !49
parents b5686136 a2ccf0a0
Branches
1 merge request!49GetAttributeBasedHash added
Showing with 14 additions and 0 deletions
......@@ -109,9 +109,23 @@ func GetHashChecksumOfFile(filePath string) (uint64, error) {
if err != nil {
return 0, err
}
return hash, nil
}
// GetAttributeBasedHash GetAttributeBasedHash
func GetAttributeBasedHash(filePath string) (string, error) {
fileInfo, statErr := os.Stat(filePath)
if statErr != nil {
logginghelper.LogError("error occured while getting stats of file : ", filePath, " : ", statErr)
return "", statErr
}
fileModTime := fileInfo.ModTime()
fileLength := fileInfo.Size()
customFileHash := strconv.FormatInt(fileModTime.Unix(), 10) + strconv.FormatInt(fileLength, 10)
return customFileHash, nil
}
//AESEncryptDefault method to encrypt with default config (securityKey)
func AESEncryptDefault(plainText []byte) ([]byte, error) {
compressedText, compressionError := Compress(plainText)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment