summaryrefslogtreecommitdiffstats
path: root/lib/md4.go
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-10-11 11:06:19 -0400
committersiddharth <s@ricketyspace.net>2021-10-11 11:06:19 -0400
commit1f308c130bd6129c6b74729451cf8c7d70244043 (patch)
treef59d27ce82302d6ead24ea678220e89a0dd84799 /lib/md4.go
parent82b2b7152bdd0e1a8d064f72eaf700344305c3cf (diff)
lib: add Mac and MacVerify for md4
Diffstat (limited to 'lib/md4.go')
-rw-r--r--lib/md4.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/md4.go b/lib/md4.go
index 632f6da..eab3073 100644
--- a/lib/md4.go
+++ b/lib/md4.go
@@ -251,3 +251,16 @@ func (md *Md4) Hash() []byte {
return d
}
+
+func (md *Md4) Mac(secret, msg []byte) []byte {
+ md.Message(append(secret, msg...))
+ return md.Hash()
+}
+
+func (md *Md4) MacVerify(secret, msg, mac []byte) bool {
+ md.Message(append(secret, msg...))
+ if BytesEqual(md.Hash(), mac) {
+ return true
+ }
+ return false
+}