diff options
author | xuri <xuri.me@gmail.com> | 2022-03-24 00:19:30 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2022-03-24 00:19:30 +0800 |
commit | 8a335225c705232fe1174755a1b1ea475456b864 (patch) | |
tree | 7bae0af1f1ce3459ad429d4fbca60a5e9b35a0e1 /crypt.go | |
parent | 139ee4c4b0c86dffbdca77da346e85a4cbd97b0c (diff) |
Format code, update documentation and remove exported variable `XMLHeaderByte`
Diffstat (limited to 'crypt.go')
-rw-r--r-- | crypt.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -629,7 +629,7 @@ func genISOPasswdHash(passwd, hashAlgorithm, salt string, spinCount int) (hashVa err = ErrPasswordLengthInvalid return } - hash, ok := map[string]string{ + algorithmName, ok := map[string]string{ "MD4": "md4", "MD5": "md5", "SHA-1": "sha1", @@ -653,11 +653,11 @@ func genISOPasswdHash(passwd, hashAlgorithm, salt string, spinCount int) (hashVa passwordBuffer, _ := encoder.Bytes([]byte(passwd)) b.Write(passwordBuffer) // Generate the initial hash. - key := hashing(hash, b.Bytes()) + key := hashing(algorithmName, b.Bytes()) // Now regenerate until spin count. for i := 0; i < spinCount; i++ { iterator := createUInt32LEBuffer(i, 4) - key = hashing(hash, key, iterator) + key = hashing(algorithmName, key, iterator) } hashValue, saltValue = base64.StdEncoding.EncodeToString(key), base64.StdEncoding.EncodeToString(s) return |