sha1.bend checks
raw source on the hub · import 0xd66ee682d4ce8c656782ca9e0e4634cb/sha1.bend as Sha1
SHA-1 pure in Bend (FIPS 180-4, no IO).
Import as: import ./sha1.bend as SHA1 Then SHA1.sha1(bytes) -> 20 bytes as List<U32>. Input is a byte list (each 0..255); output is 20 bytes.
Discipline (user-land Bend has no Base carve-out): - every callee is defined ABOVE its caller; only self-recursion. - match scrutinees are params or pattern-bound vars, never computed. - helpers above drivers are leaves: they never call back down. - state threads as Lists (no 4+ tuples), single-def recursion only.
1 import
import Base
Definitions
def rotl1 source · line 16 · raw
@+x:U32 -> U32
def rotl5 source · line 19 · raw
@+x:U32 -> U32
def rotl30 source · line 22 · raw
@+x:U32 -> U32
def ch source · line 27 · raw
@+x:U32 -> @+y:U32 -> @+z:U32 -> U32
def maj source · line 30 · raw
@+x:U32 -> @+y:U32 -> @+z:U32 -> U32
def par source · line 33 · raw
@+x:U32 -> @+y:U32 -> @+z:U32 -> U32
def get_or0 source · line 38 · raw
@m:Maybe<&2, U32> -> U32
def list_get source · line 45 · raw
@+xs:List<&2, U32> -> @n:Nat -> U32
def word_of4 source · line 50 · raw
@+b0:U32 -> @+b1:U32 -> @+b2:U32 -> @+b3:U32 -> U32
def bytes_of_word source · line 55 · raw
@+w:U32 -> List<&2, U32>
def k_of.go source · line 60 · raw
@is20:Bool -> @is40:Bool -> @is60:Bool -> U32
def k_of source · line 79 · raw
@+idx:Nat -> U32
def f_of.go source · line 84 · raw
@is20:Bool -> @is40:Bool -> @is60:Bool -> @+b:U32 -> @+c:U32 -> @+d:U32 -> U32
def f_of source · line 103 · raw
@+idx:Nat -> @+b:U32 -> @+c:U32 -> @+d:U32 -> U32
def temp_of source · line 108 · raw
@+a:U32 -> @+f:U32 -> @+e:U32 -> @+k:U32 -> @+w:U32 -> U32
def words_of_bytes source · line 114 · raw
@bs:List<&2, U32> -> List<&2, U32>
def sched_word source · line 135 · raw
@+a:U32 -> @+b:U32 -> @+c:U32 -> @+d:U32 -> U32
def expand_go source · line 140 · raw
@fuel:Nat -> @+idx:Nat -> @+acc:List<&2, U32> -> List<&2, U32>
def expand source · line 153 · raw
@w16:List<&2, U32> -> List<&2, U32>
def add5.go source · line 158 · raw
@+h:List<&2, U32> -> @+s:List<&2, U32> -> List<&2, U32>
def add5 source · line 161 · raw
@+h:List<&2, U32> -> @+s:List<&2, U32> -> List<&2, U32>
def step_list source · line 166 · raw
@+st:List<&2, U32> -> @+w:U32 -> @+idx:Nat -> List<&2, U32>
def rounds source · line 179 · raw
@ws:List<&2, U32> -> @+st:List<&2, U32> -> @+idx:Nat -> List<&2, U32>
def h_init source · line 188 · raw
List<&2, U32>
def block_go source · line 193 · raw
@+h:List<&2, U32> -> @+blk:List<&2, U32> -> List<&2, U32>
def take64 source · line 199 · raw
@+bs:List<&2, U32> -> List<&2, U32>
def drop64 source · line 202 · raw
@+bs:List<&2, U32> -> List<&2, U32>
def is_nil source · line 205 · raw
@bs:List<&2, U32> -> Bool
def blocks_go source · line 214 · raw
@fuel:Nat -> @+h:List<&2, U32> -> @+bs:List<&2, U32> -> List<&2, U32>
def pad_lenbytes source · line 226 · raw
@+bitlen:U32 -> List<&2, U32>
def pad_zeros source · line 229 · raw
@k:Nat -> List<&2, U32>
def pad_count source · line 232 · raw
@+len:Nat -> Nat
def padded source · line 235 · raw
@+bs:List<&2, U32> -> List<&2, U32>
def words_to_bytes source · line 242 · raw
@ws:List<&2, U32> -> List<&2, U32>
def block_count source · line 251 · raw
@+bs:List<&2, U32> -> Nat
def sha1.go source · line 254 · raw
@+padded:List<&2, U32> -> List<&2, U32>
def sha1 source · line 257 · raw
@+bs:List<&2, U32> -> List<&2, U32>