raw
ffa_ch6_simplest_...    1 ------------------------------------------------------------------------------
ffa_ch6_simplest_... 2 ------------------------------------------------------------------------------
ffa_ch6_simplest_... 3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
ffa_ch6_simplest_... 4 -- --
ffa_ch15_gcd.kv 5 -- (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) --
ffa_ch6_simplest_... 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
ffa_ch6_simplest_... 7 -- --
ffa_ch6_simplest_... 8 -- You do not have, nor can you ever acquire the right to use, copy or --
ffa_ch6_simplest_... 9 -- distribute this software ; Should you use this software for any purpose, --
ffa_ch6_simplest_... 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
ffa_ch6_simplest_... 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
ffa_ch6_simplest_... 12 -- continue doing so for the indefinite future. In any case, please --
ffa_ch6_simplest_... 13 -- always : read and understand any software ; verify any PGP signatures --
ffa_ch6_simplest_... 14 -- that you use - for any purpose. --
ffa_ch6_simplest_... 15 -- --
ffa_ch6_simplest_... 16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
ffa_ch6_simplest_... 17 ------------------------------------------------------------------------------
ffa_ch6_simplest_... 18 ------------------------------------------------------------------------------
ffa_ch6_simplest_... 19
ffa_ch6_simplest_... 20 with FZ_Type; use FZ_Type;
ffa_ch16_miller_r... 21 with FZ_Barr; use FZ_Barr;
ffa_ch6_simplest_... 22
ffa_ch6_simplest_... 23
ffa_ch6_simplest_... 24 package FZ_ModEx is
ffa_ch6_simplest_... 25
ffa_ch6_simplest_... 26 pragma Pure;
ffa_ch6_simplest_... 27
ffa_ch14_barrett.kv 28 -- (Conventional) Modular Multiply: Product := X*Y mod Modulus
ffa_ch6_simplest_... 29 procedure FZ_Mod_Mul(X : in FZ;
ffa_ch6_simplest_... 30 Y : in FZ;
ffa_ch6_simplest_... 31 Modulus : in FZ;
ffa_ch11_tuning_a... 32 Product : out FZ)
ffa_ch11_tuning_a... 33 with Pre => X'Length = Y'Length and
ffa_ch11_tuning_a... 34 Modulus'Length = X'Length and
ffa_ch11_tuning_a... 35 Product'Length = Modulus'Length;
ffa_ch6_simplest_... 36
ffa_ch14_barrett.kv 37 -- (Conventional) Modular Squaring: Product := X*X mod Modulus
ffa_ch12_karatsub... 38 procedure FZ_Mod_Sqr(X : in FZ;
ffa_ch12_karatsub... 39 Modulus : in FZ;
ffa_ch12_karatsub... 40 Product : out FZ)
ffa_ch12_karatsub... 41 with Pre => Modulus'Length = X'Length and
ffa_ch12_karatsub... 42 Product'Length = Modulus'Length;
ffa_ch12_karatsub... 43
ffa_ch16_miller_r... 44 -- (Barrettronic) Modular Squaring, using given Barrettoid
ffa_ch16_miller_r... 45 procedure FZ_Mod_Sqr_Barrett(X : in FZ;
ffa_ch16_miller_r... 46 Bar : in Barretoid;
ffa_ch16_miller_r... 47 Product : out FZ);
ffa_ch16_miller_r... 48 pragma Inline_Always(FZ_Mod_Sqr_Barrett);
ffa_ch16_miller_r... 49
ffa_ch16_miller_r... 50 -- Barrettronic Modular Exponent, using given Barrettoid
ffa_ch16_miller_r... 51 procedure FZ_Mod_Exp_Barrett(Base : in FZ;
ffa_ch16_miller_r... 52 Exponent : in FZ;
ffa_ch16_miller_r... 53 Bar : in Barretoid;
ffa_ch16_miller_r... 54 Result : out FZ);
ffa_ch16_miller_r... 55 pragma Inline_Always(FZ_Mod_Exp_Barrett);
ffa_ch16_miller_r... 56
ffa_ch14_barrett.kv 57 -- (Barrettronic) Modular Exponent: Result := Base^Exponent mod Modulus
ffa_ch6_simplest_... 58 procedure FZ_Mod_Exp(Base : in FZ;
ffa_ch6_simplest_... 59 Exponent : in FZ;
ffa_ch6_simplest_... 60 Modulus : in FZ;
ffa_ch11_tuning_a... 61 Result : out FZ) with
ffa_ch11_tuning_a... 62 Pre => Base'Length = Exponent'Length and
ffa_ch11_tuning_a... 63 Base'Length = Result'Length and
ffa_ch11_tuning_a... 64 Base'Length = Modulus'Length;
ffa_ch6_simplest_... 65
ffa_ch6_simplest_... 66 end FZ_ModEx;