tours256.miaou
← Le code · src/outil/miaou/tours256.miaou · 30 lignes
(node tours256
(params (s Sh) (ks (Liste Nat)) (ws (Liste Nat)))
(returns Sh)
(intent "les tours de compression de SHA-256 sur l'état s, une constante de ks et un mot de ws par tour")
(origin "phase 8f6 : le hasard de Python en miaou, d'après h_sha256 de l'outil inter")
(effects)
(uses sig256 ch32 maj32 b_add32)
(requires
true)
(ensures
true)
(decreases ks)
(examples
(ex ((record Sh (a 1) (b 2) (c 3) (d 4) (e 5) (f 6) (g 7) (h 8)) (list) (list))
(record Sh (a 1) (b 2) (c 3) (d 4) (e 5) (f 6) (g 7) (h 8))))
(equivalence exact)
(body.high
(match ks
(case empty () s)
(case cons
(k rk)
(match ws
(case empty () s)
(case cons
(w rw)
(let ((t1 (b_add32 (b_add32 (b_add32 (get s h) (sig256 (get s e) 3)) (b_add32 (ch32 (get s e) (get s f) (get s g)) k)) w)) (t2 (b_add32 (sig256 (get s a) 2) (maj32 (get s a) (get s b) (get s c)))))
(tours256 (record Sh (a (b_add32 t1 t2)) (b (get s a)) (c (get s b)) (d (get s c)) (e (b_add32 (get s d) t1)) (f (get s e)) (g (get s f)) (h (get s g)))
rk
rw)))))))
(end node tours256))