diff options
author | siddharth <s@ricketyspace.net> | 2021-10-09 11:46:08 -0400 |
---|---|---|
committer | siddharth <s@ricketyspace.net> | 2021-10-09 11:46:08 -0400 |
commit | fafa79cc3198e980e60de0b23af7e7ad03e37aad (patch) | |
tree | 7166a8edddfca10c0aea79e74934be219697db86 /challenge | |
parent | 21d8ade047ff938df52b7a1d85c65fcc9147db81 (diff) |
lib: refactor sha1 implementation
Add ability to set initial hash values for Sha1
Diffstat (limited to 'challenge')
-rw-r--r-- | challenge/c28.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/challenge/c28.go b/challenge/c28.go index 7a763d5..a54be26 100644 --- a/challenge/c28.go +++ b/challenge/c28.go @@ -35,11 +35,14 @@ I'm pushin' away, I'm pushin' away Yeah I'm pushin' away, pushin' away`) sec := lib.StrToBytes("Milk Records") + // Init SHA1 + sha1 := lib.Sha1{} + // Generate SHA1 MAC. - mac := lib.Sha1Mac(sec, msg) + mac := sha1.Mac(sec, msg) // Verify. - if lib.Sha1MacVerify(sec, msg, mac) != true { + if sha1.MacVerify(sec, msg, mac) != true { fmt.Printf("Error: Sha1Mac verification failed!\n") return } @@ -48,7 +51,7 @@ Yeah I'm pushin' away, pushin' away`) msg[42] = byte(42) // Verify that SHA1 MAC fails - if lib.Sha1MacVerify(sec, msg, mac) != false { + if sha1.MacVerify(sec, msg, mac) != false { fmt.Printf("Error: Sha1Mac verification success!\n") return } |