miaou — le blogv1.0.3

sh_ajouter.miaou

← Le code · src/outil/miaou/sh_ajouter.miaou · 26 lignes

(node sh_ajouter
  (params (x Sh) (y Sh))
  (returns Sh)
  (intent "les deux états de SHA-256 ajoutés mot à mot, modulo 2 puissance 32")
  (origin "phase 8f6 : le hasard de Python en miaou, d'après h_sha256 de l'outil inter")
  (effects)
  (uses b_add32)
  (requires
    true)
  (ensures
    true)
  (examples
    (ex ((record Sh (a 1) (b 2) (c 3) (d 4) (e 5) (f 6) (g 7) (h 8)) (record Sh (a 1) (b 2) (c 3) (d 4) (e 5) (f 6) (g 7) (h 8)))
      (record Sh (a 2) (b 4) (c 6) (d 8) (e 10) (f 12) (g 14) (h 16))))
  (equivalence exact)
  (body.high
    (record Sh
      (a (b_add32 (get x a) (get y a)))
      (b (b_add32 (get x b) (get y b)))
      (c (b_add32 (get x c) (get y c)))
      (d (b_add32 (get x d) (get y d)))
      (e (b_add32 (get x e) (get y e)))
      (f (b_add32 (get x f) (get y f)))
      (g (b_add32 (get x g) (get y g)))
      (h (b_add32 (get x h) (get y h)))))
  (end node sh_ajouter))