Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
coreospackage
Commits
b00dc948
Commit
b00dc948
authored
6 years ago
by
Ajit Jagtap
Browse files
Options
Downloads
Plain Diff
Merge branch 'GetAttributeBasedHash' into 'master'
GetAttributeBasedHash added See merge request
!49
parents
b5686136
a2ccf0a0
Branches
Branches containing commit
1 merge request
!49
GetAttributeBasedHash added
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
securityhelper/securityHelper.go
+14
-0
securityhelper/securityHelper.go
with
14 additions
and
0 deletions
securityhelper/securityHelper.go
+
14
−
0
View file @
b00dc948
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets