From 8a335225c705232fe1174755a1b1ea475456b864 Mon Sep 17 00:00:00 2001 From: xuri Date: Thu, 24 Mar 2022 00:19:30 +0800 Subject: Format code, update documentation and remove exported variable `XMLHeaderByte` --- crypt.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crypt.go') diff --git a/crypt.go b/crypt.go index c579a10..8a783a9 100644 --- a/crypt.go +++ b/crypt.go @@ -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 -- cgit v1.2.1