MCPcopy Index your code
hub / github.com/TruthHun/BookStack / hash

Function hash

utils/password.go:67–99  ·  view source on GitHub ↗
(pass string, saltSecret string, salt string, interation int64)

Source from the content-addressed store, hash-verified

65}
66
67func hash(pass string, saltSecret string, salt string, interation int64) (string, error) {
68 var passSalt = saltSecret + pass + salt + saltSecret + pass + salt + pass + pass + salt
69 var i int
70
71 hashPass := saltLocalSecret
72 hashStart := sha512.New()
73 hashCenter := sha256.New()
74 hashOutput := sha256.New224()
75
76 i = 0
77 for i <= stretchingPassword {
78 i = i + 1
79 hashStart.Write([]byte(passSalt + hashPass))
80 hashPass = hex.EncodeToString(hashStart.Sum(nil))
81 }
82
83 i = 0
84 for int64(i) <= interation {
85 i = i + 1
86 hashPass = hashPass + hashPass
87 }
88
89 i = 0
90 for i <= stretchingPassword {
91 i = i + 1
92 hashCenter.Write([]byte(hashPass + saltSecret))
93 hashPass = hex.EncodeToString(hashCenter.Sum(nil))
94 }
95 hashOutput.Write([]byte(hashPass + saltLocalSecret))
96 hashPass = hex.EncodeToString(hashOutput.Sum(nil))
97
98 return hashPass, nil
99}
100
101func trimSaltHash(hash string) map[string]string {
102 str := strings.Split(hash, delimiter)

Callers 2

PasswordHashFunction · 0.85
PasswordVerifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected