Skip to content

Commit 9e5cb19

Browse files
committed
add: implement SHA spec
1 parent de02e6f commit 9e5cb19

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Spec/SHA.lean

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Spec
2+
3+
abbrev Octet := UInt8
4+
abbrev Bytes := Array Octet
5+
6+
structure Hash where
7+
hash: Bytes -> Bytes
8+
L : Nat
9+
B : Nat
10+
deriving Inhabited
11+
12+
namespace SHA
13+
14+
def mk(L B : Nat) (h : Bytes -> Bytes) : Hash :=
15+
{ hash := h, L := L, B := B }
16+
17+
def SHA1 (h : Bytes -> Bytes) : Hash :=
18+
mk 20 64 h
19+
20+
end SHA
21+
22+
end Spec

0 commit comments

Comments
 (0)