modexp.miaou
← Le code · src/rsa/modexp.miaou · 29 lignes
(node modexp
(params (b Grand) (e Grand) (n Grand))
(returns Grand)
(intent "b puissance e modulo n (b et e positifs, n positif non nul) : les bits de e, sur 32 bits par mot, passés par puiss_bits à partir de 1, b réduit modulo n d'abord (la primitive RSA : RSAEP, RSADP, RSASP1, RSAVP1 de la RFC 8017)")
(origin "duel 4 : RSA en miaou")
(effects)
(uses puiss_bits
../outil/miaou/gr_bits
../outil/miaou/renverser_nats
../outil/miaou/gr_divmod
../outil/miaou/gr_de_nat)
(requires
true)
(ensures
true)
(examples
(ex ((record Grand (neg false) (mots (list 65))) (record Grand (neg false) (mots (list 17))) (record Grand (neg false) (mots (list 3233))))
(record Grand (neg false) (mots (list 2790))))
(ex ((record Grand (neg false) (mots (list 2790))) (record Grand (neg false) (mots (list 2753))) (record Grand (neg false) (mots (list 3233))))
(record Grand (neg false) (mots (list 65))))
(ex ((record Grand (neg false) (mots (list 65))) (record Grand (neg false) (mots (list))) (record Grand (neg false) (mots (list 3233))))
(record Grand (neg false) (mots (list 1)))))
(equivalence exact)
(body.high
(puiss_bits (gr_bits (renverser_nats (get e mots) (list)))
(get (gr_divmod b n) r)
n
(gr_de_nat 1)))
(end node modexp))