diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-16 21:28:33 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-16 21:28:33 +0800 |
commit | 702218008ee2b6d708d6b2821cdef80736bb3224 (patch) | |
tree | d55ff7ce88187082378e7d8e4c2f3aad14d23b4e /Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/modexp.se | |
parent | 202362d9258335c695eb75f55f4be74a50a1af33 (diff) | |
download | go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.gz go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.zst go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.zip |
Add versioned dependencies from godep
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/modexp.se')
-rw-r--r-- | Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/modexp.se | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/modexp.se b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/modexp.se new file mode 100644 index 000000000..687b12a04 --- /dev/null +++ b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/ecc/modexp.se @@ -0,0 +1,11 @@ +def call(b, e, m): + with o = 1: + with bit = 2 ^ 255: + while gt(bit, 0): + # A touch of loop unrolling for 20% efficiency gain + o = mulmod(mulmod(o, o, m), b ^ !(!(e & bit)), m) + o = mulmod(mulmod(o, o, m), b ^ !(!(e & div(bit, 2))), m) + o = mulmod(mulmod(o, o, m), b ^ !(!(e & div(bit, 4))), m) + o = mulmod(mulmod(o, o, m), b ^ !(!(e & div(bit, 8))), m) + bit = div(bit, 16) + return(o) |