From ef94324f2e75e8a08181e681a3c761938d794758 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 28 Sep 2023 15:35:07 -0300 Subject: [PATCH] implement ripemd160 just so we can validate peter todd's old examples. --- ots.go | 2 +- unused.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 unused.go diff --git a/ots.go b/ots.go index c0eb09d..d6c1591 100644 --- a/ots.go +++ b/ots.go @@ -44,7 +44,7 @@ var tags = map[byte]*Operation{ 0xf2: {"reverse", 0xf2, false, func(curr []byte, arg []byte) []byte { panic("reverse not implemented") }}, 0xf3: {"hexlify", 0xf3, false, func(curr []byte, arg []byte) []byte { panic("hexlify not implemented") }}, 0x02: {"sha1", 0x02, false, func(curr []byte, arg []byte) []byte { panic("sha1 not implemented") }}, - 0x03: {"ripemd160", 0x03, false, func(curr []byte, arg []byte) []byte { panic("ripemd160 not implemented") }}, + 0x03: {"ripemd160", 0x03, false, ripemd160}, 0x08: {"sha256", 0x08, false, func(curr []byte, arg []byte) []byte { v := sha256.Sum256(curr) return v[:] diff --git a/unused.go b/unused.go new file mode 100644 index 0000000..6118792 --- /dev/null +++ b/unused.go @@ -0,0 +1,9 @@ +package opentimestamps + +import ( + deprecated_ripemd160 "golang.org/x/crypto/ripemd160" +) + +func ripemd160(curr []byte, arg []byte) []byte { + return deprecated_ripemd160.New().Sum(curr) +}