miaou — le blogv1.0.3

vc_ajouter.miaou

← Le code · src/outil/miaou/vc_ajouter.miaou · 22 lignes

(node vc_ajouter
  (params (h Hache) (nom (Liste Octet)) (contenu (Liste Octet)))
  (returns Hache)
  (intent "un fichier ajouté à l'empreinte h : son nom, un octet nul, la longueur de son contenu en décimal, un octet nul, puis le contenu ; la longueur en tête sépare sans ambiguïté un fichier du suivant")
  (origin "phase H1c : la vérification incrémentale")
  (effects)
  (uses vc_hacher chiffres_de)
  (requires
    (and (lt (get h a) 2147483647)
      (and (lt (get h b) 2147483647) (and (lt (get h c) 2147483647) (lt (get h d) 2147483647)))))
  (ensures
    (and (lt (get r a) 2147483647)
      (and (lt (get r b) 2147483647) (and (lt (get r c) 2147483647) (lt (get r d) 2147483647)))))
  (examples
    (ex ((record Hache (a 0) (b 0) (c 0) (d 0)) "a" "")
      (record Hache (a 923759552) (b 430137680) (c 419082318) (d 1207489275))))
  (equivalence exact)
  (body.high
    (vc_hacher contenu
      (vc_hacher (list 0)
        (vc_hacher (chiffres_de (len contenu)) (vc_hacher (list 0) (vc_hacher nom h))))))
  (end node vc_ajouter))