5 changed files with 2146 additions and 2146 deletions
@ -1,4 +1,4 @@ |
|||||||
Copyright (c) 2010-2011, Jeff Bell [www.randombell.com] | [jeffbell@randombell.com]. |
Copyright (c) 2010-2011, Jeff Bell [www.randombell.com] | [jeffbell@randombell.com]. |
||||||
This font may be distributed freely however must retain this document as well as the Readme.txt file. |
This font may be distributed freely however must retain this document as well as the Readme.txt file. |
||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1. |
This Font Software is licensed under the SIL Open Font License, Version 1.1. |
||||||
This license is available with a FAQ at: http://scripts.sil.org/OFL |
This license is available with a FAQ at: http://scripts.sil.org/OFL |
||||||
|
|||||||
@ -1,94 +1,94 @@ |
|||||||
Copyright (c) 2011, ParaType Ltd. (http://www.paratype.com/public), |
Copyright (c) 2011, ParaType Ltd. (http://www.paratype.com/public), |
||||||
with Reserved Font Names "PT Sans", "PT Serif", "PT Mono" and "ParaType". |
with Reserved Font Names "PT Sans", "PT Serif", "PT Mono" and "ParaType". |
||||||
|
|
||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1. |
This Font Software is licensed under the SIL Open Font License, Version 1.1. |
||||||
This license is copied below, and is also available with a FAQ at: |
This license is copied below, and is also available with a FAQ at: |
||||||
http://scripts.sil.org/OFL |
http://scripts.sil.org/OFL |
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------------- |
----------------------------------------------------------- |
||||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 |
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 |
||||||
----------------------------------------------------------- |
----------------------------------------------------------- |
||||||
|
|
||||||
PREAMBLE |
PREAMBLE |
||||||
The goals of the Open Font License (OFL) are to stimulate worldwide |
The goals of the Open Font License (OFL) are to stimulate worldwide |
||||||
development of collaborative font projects, to support the font creation |
development of collaborative font projects, to support the font creation |
||||||
efforts of academic and linguistic communities, and to provide a free and |
efforts of academic and linguistic communities, and to provide a free and |
||||||
open framework in which fonts may be shared and improved in partnership |
open framework in which fonts may be shared and improved in partnership |
||||||
with others. |
with others. |
||||||
|
|
||||||
The OFL allows the licensed fonts to be used, studied, modified and |
The OFL allows the licensed fonts to be used, studied, modified and |
||||||
redistributed freely as long as they are not sold by themselves. The |
redistributed freely as long as they are not sold by themselves. The |
||||||
fonts, including any derivative works, can be bundled, embedded, |
fonts, including any derivative works, can be bundled, embedded, |
||||||
redistributed and/or sold with any software provided that any reserved |
redistributed and/or sold with any software provided that any reserved |
||||||
names are not used by derivative works. The fonts and derivatives, |
names are not used by derivative works. The fonts and derivatives, |
||||||
however, cannot be released under any other type of license. The |
however, cannot be released under any other type of license. The |
||||||
requirement for fonts to remain under this license does not apply |
requirement for fonts to remain under this license does not apply |
||||||
to any document created using the fonts or their derivatives. |
to any document created using the fonts or their derivatives. |
||||||
|
|
||||||
DEFINITIONS |
DEFINITIONS |
||||||
"Font Software" refers to the set of files released by the Copyright |
"Font Software" refers to the set of files released by the Copyright |
||||||
Holder(s) under this license and clearly marked as such. This may |
Holder(s) under this license and clearly marked as such. This may |
||||||
include source files, build scripts and documentation. |
include source files, build scripts and documentation. |
||||||
|
|
||||||
"Reserved Font Name" refers to any names specified as such after the |
"Reserved Font Name" refers to any names specified as such after the |
||||||
copyright statement(s). |
copyright statement(s). |
||||||
|
|
||||||
"Original Version" refers to the collection of Font Software components as |
"Original Version" refers to the collection of Font Software components as |
||||||
distributed by the Copyright Holder(s). |
distributed by the Copyright Holder(s). |
||||||
|
|
||||||
"Modified Version" refers to any derivative made by adding to, deleting, |
"Modified Version" refers to any derivative made by adding to, deleting, |
||||||
or substituting -- in part or in whole -- any of the components of the |
or substituting -- in part or in whole -- any of the components of the |
||||||
Original Version, by changing formats or by porting the Font Software to a |
Original Version, by changing formats or by porting the Font Software to a |
||||||
new environment. |
new environment. |
||||||
|
|
||||||
"Author" refers to any designer, engineer, programmer, technical |
"Author" refers to any designer, engineer, programmer, technical |
||||||
writer or other person who contributed to the Font Software. |
writer or other person who contributed to the Font Software. |
||||||
|
|
||||||
PERMISSION & CONDITIONS |
PERMISSION & CONDITIONS |
||||||
Permission is hereby granted, free of charge, to any person obtaining |
Permission is hereby granted, free of charge, to any person obtaining |
||||||
a copy of the Font Software, to use, study, copy, merge, embed, modify, |
a copy of the Font Software, to use, study, copy, merge, embed, modify, |
||||||
redistribute, and sell modified and unmodified copies of the Font |
redistribute, and sell modified and unmodified copies of the Font |
||||||
Software, subject to the following conditions: |
Software, subject to the following conditions: |
||||||
|
|
||||||
1) Neither the Font Software nor any of its individual components, |
1) Neither the Font Software nor any of its individual components, |
||||||
in Original or Modified Versions, may be sold by itself. |
in Original or Modified Versions, may be sold by itself. |
||||||
|
|
||||||
2) Original or Modified Versions of the Font Software may be bundled, |
2) Original or Modified Versions of the Font Software may be bundled, |
||||||
redistributed and/or sold with any software, provided that each copy |
redistributed and/or sold with any software, provided that each copy |
||||||
contains the above copyright notice and this license. These can be |
contains the above copyright notice and this license. These can be |
||||||
included either as stand-alone text files, human-readable headers or |
included either as stand-alone text files, human-readable headers or |
||||||
in the appropriate machine-readable metadata fields within text or |
in the appropriate machine-readable metadata fields within text or |
||||||
binary files as long as those fields can be easily viewed by the user. |
binary files as long as those fields can be easily viewed by the user. |
||||||
|
|
||||||
3) No Modified Version of the Font Software may use the Reserved Font |
3) No Modified Version of the Font Software may use the Reserved Font |
||||||
Name(s) unless explicit written permission is granted by the corresponding |
Name(s) unless explicit written permission is granted by the corresponding |
||||||
Copyright Holder. This restriction only applies to the primary font name as |
Copyright Holder. This restriction only applies to the primary font name as |
||||||
presented to the users. |
presented to the users. |
||||||
|
|
||||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font |
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font |
||||||
Software shall not be used to promote, endorse or advertise any |
Software shall not be used to promote, endorse or advertise any |
||||||
Modified Version, except to acknowledge the contribution(s) of the |
Modified Version, except to acknowledge the contribution(s) of the |
||||||
Copyright Holder(s) and the Author(s) or with their explicit written |
Copyright Holder(s) and the Author(s) or with their explicit written |
||||||
permission. |
permission. |
||||||
|
|
||||||
5) The Font Software, modified or unmodified, in part or in whole, |
5) The Font Software, modified or unmodified, in part or in whole, |
||||||
must be distributed entirely under this license, and must not be |
must be distributed entirely under this license, and must not be |
||||||
distributed under any other license. The requirement for fonts to |
distributed under any other license. The requirement for fonts to |
||||||
remain under this license does not apply to any document created |
remain under this license does not apply to any document created |
||||||
using the Font Software. |
using the Font Software. |
||||||
|
|
||||||
TERMINATION |
TERMINATION |
||||||
This license becomes null and void if any of the above conditions are |
This license becomes null and void if any of the above conditions are |
||||||
not met. |
not met. |
||||||
|
|
||||||
DISCLAIMER |
DISCLAIMER |
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF |
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT |
||||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE |
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE |
||||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
||||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL |
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL |
||||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM |
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM |
||||||
OTHER DEALINGS IN THE FONT SOFTWARE. |
OTHER DEALINGS IN THE FONT SOFTWARE. |
||||||
|
|||||||
@ -1,393 +1,393 @@ |
|||||||
## ripemd.py - pure Python implementation of the RIPEMD-160 algorithm. |
## ripemd.py - pure Python implementation of the RIPEMD-160 algorithm. |
||||||
## Bjorn Edstrom <be@bjrn.se> 16 december 2007. |
## Bjorn Edstrom <be@bjrn.se> 16 december 2007. |
||||||
## |
## |
||||||
## Copyrights |
## Copyrights |
||||||
## ========== |
## ========== |
||||||
## |
## |
||||||
## This code is a derived from an implementation by Markus Friedl which is |
## This code is a derived from an implementation by Markus Friedl which is |
||||||
## subject to the following license. This Python implementation is not |
## subject to the following license. This Python implementation is not |
||||||
## subject to any other license. |
## subject to any other license. |
||||||
## |
## |
||||||
##/* |
##/* |
||||||
## * Copyright (c) 2001 Markus Friedl. All rights reserved. |
## * Copyright (c) 2001 Markus Friedl. All rights reserved. |
||||||
## * |
## * |
||||||
## * Redistribution and use in source and binary forms, with or without |
## * Redistribution and use in source and binary forms, with or without |
||||||
## * modification, are permitted provided that the following conditions |
## * modification, are permitted provided that the following conditions |
||||||
## * are met: |
## * are met: |
||||||
## * 1. Redistributions of source code must retain the above copyright |
## * 1. Redistributions of source code must retain the above copyright |
||||||
## * notice, this list of conditions and the following disclaimer. |
## * notice, this list of conditions and the following disclaimer. |
||||||
## * 2. Redistributions in binary form must reproduce the above copyright |
## * 2. Redistributions in binary form must reproduce the above copyright |
||||||
## * notice, this list of conditions and the following disclaimer in the |
## * notice, this list of conditions and the following disclaimer in the |
||||||
## * documentation and/or other materials provided with the distribution. |
## * documentation and/or other materials provided with the distribution. |
||||||
## * |
## * |
||||||
## * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
## * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
||||||
## * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
## * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||||||
## * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
## * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||||||
## * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
## * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||||||
## * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
## * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||||||
## * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
## * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
## * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
## * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
## * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
## * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
## * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
## * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||||||
## * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
## * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
## */ |
## */ |
||||||
##/* |
##/* |
||||||
## * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", |
## * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", |
||||||
## * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, |
## * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, |
||||||
## * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf |
## * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf |
||||||
## */ |
## */ |
||||||
|
|
||||||
#block_size = 1 |
#block_size = 1 |
||||||
digest_size = 20 |
digest_size = 20 |
||||||
digestsize = 20 |
digestsize = 20 |
||||||
|
|
||||||
class RIPEMD160: |
class RIPEMD160: |
||||||
"""Return a new RIPEMD160 object. An optional string argument |
"""Return a new RIPEMD160 object. An optional string argument |
||||||
may be provided; if present, this string will be automatically |
may be provided; if present, this string will be automatically |
||||||
hashed.""" |
hashed.""" |
||||||
|
|
||||||
def __init__(self, arg=None): |
def __init__(self, arg=None): |
||||||
self.ctx = RMDContext() |
self.ctx = RMDContext() |
||||||
if arg: |
if arg: |
||||||
self.update(arg) |
self.update(arg) |
||||||
self.dig = None |
self.dig = None |
||||||
|
|
||||||
def update(self, arg): |
def update(self, arg): |
||||||
"""update(arg)""" |
"""update(arg)""" |
||||||
RMD160Update(self.ctx, arg, len(arg)) |
RMD160Update(self.ctx, arg, len(arg)) |
||||||
self.dig = None |
self.dig = None |
||||||
|
|
||||||
def digest(self): |
def digest(self): |
||||||
"""digest()""" |
"""digest()""" |
||||||
if self.dig: |
if self.dig: |
||||||
return self.dig |
return self.dig |
||||||
ctx = self.ctx.copy() |
ctx = self.ctx.copy() |
||||||
self.dig = RMD160Final(self.ctx) |
self.dig = RMD160Final(self.ctx) |
||||||
self.ctx = ctx |
self.ctx = ctx |
||||||
return self.dig |
return self.dig |
||||||
|
|
||||||
def hexdigest(self): |
def hexdigest(self): |
||||||
"""hexdigest()""" |
"""hexdigest()""" |
||||||
dig = self.digest() |
dig = self.digest() |
||||||
hex_digest = '' |
hex_digest = '' |
||||||
for d in dig: |
for d in dig: |
||||||
hex_digest += '%02x' % d |
hex_digest += '%02x' % d |
||||||
return hex_digest |
return hex_digest |
||||||
|
|
||||||
def copy(self): |
def copy(self): |
||||||
"""copy()""" |
"""copy()""" |
||||||
import copy |
import copy |
||||||
return copy.deepcopy(self) |
return copy.deepcopy(self) |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def new(arg=None): |
def new(arg=None): |
||||||
"""Return a new RIPEMD160 object. An optional string argument |
"""Return a new RIPEMD160 object. An optional string argument |
||||||
may be provided; if present, this string will be automatically |
may be provided; if present, this string will be automatically |
||||||
hashed.""" |
hashed.""" |
||||||
return RIPEMD160(arg) |
return RIPEMD160(arg) |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# |
# |
||||||
# Private. |
# Private. |
||||||
# |
# |
||||||
|
|
||||||
class RMDContext: |
class RMDContext: |
||||||
def __init__(self): |
def __init__(self): |
||||||
self.state = [0x67452301, 0xEFCDAB89, 0x98BADCFE, |
self.state = [0x67452301, 0xEFCDAB89, 0x98BADCFE, |
||||||
0x10325476, 0xC3D2E1F0] # uint32 |
0x10325476, 0xC3D2E1F0] # uint32 |
||||||
self.count = 0 # uint64 |
self.count = 0 # uint64 |
||||||
self.buffer = [0]*64 # uchar |
self.buffer = [0]*64 # uchar |
||||||
def copy(self): |
def copy(self): |
||||||
ctx = RMDContext() |
ctx = RMDContext() |
||||||
ctx.state = self.state[:] |
ctx.state = self.state[:] |
||||||
ctx.count = self.count |
ctx.count = self.count |
||||||
ctx.buffer = self.buffer[:] |
ctx.buffer = self.buffer[:] |
||||||
return ctx |
return ctx |
||||||
|
|
||||||
K0 = 0x00000000 |
K0 = 0x00000000 |
||||||
K1 = 0x5A827999 |
K1 = 0x5A827999 |
||||||
K2 = 0x6ED9EBA1 |
K2 = 0x6ED9EBA1 |
||||||
K3 = 0x8F1BBCDC |
K3 = 0x8F1BBCDC |
||||||
K4 = 0xA953FD4E |
K4 = 0xA953FD4E |
||||||
|
|
||||||
KK0 = 0x50A28BE6 |
KK0 = 0x50A28BE6 |
||||||
KK1 = 0x5C4DD124 |
KK1 = 0x5C4DD124 |
||||||
KK2 = 0x6D703EF3 |
KK2 = 0x6D703EF3 |
||||||
KK3 = 0x7A6D76E9 |
KK3 = 0x7A6D76E9 |
||||||
KK4 = 0x00000000 |
KK4 = 0x00000000 |
||||||
|
|
||||||
def ROL(n, x): |
def ROL(n, x): |
||||||
return ((x << n) & 0xffffffff) | (x >> (32 - n)) |
return ((x << n) & 0xffffffff) | (x >> (32 - n)) |
||||||
|
|
||||||
def F0(x, y, z): |
def F0(x, y, z): |
||||||
return x ^ y ^ z |
return x ^ y ^ z |
||||||
|
|
||||||
def F1(x, y, z): |
def F1(x, y, z): |
||||||
return (x & y) | (((~x) % 0x100000000) & z) |
return (x & y) | (((~x) % 0x100000000) & z) |
||||||
|
|
||||||
def F2(x, y, z): |
def F2(x, y, z): |
||||||
return (x | ((~y) % 0x100000000)) ^ z |
return (x | ((~y) % 0x100000000)) ^ z |
||||||
|
|
||||||
def F3(x, y, z): |
def F3(x, y, z): |
||||||
return (x & z) | (((~z) % 0x100000000) & y) |
return (x & z) | (((~z) % 0x100000000) & y) |
||||||
|
|
||||||
def F4(x, y, z): |
def F4(x, y, z): |
||||||
return x ^ (y | ((~z) % 0x100000000)) |
return x ^ (y | ((~z) % 0x100000000)) |
||||||
|
|
||||||
def R(a, b, c, d, e, Fj, Kj, sj, rj, X): |
def R(a, b, c, d, e, Fj, Kj, sj, rj, X): |
||||||
a = ROL(sj, (a + Fj(b, c, d) + X[rj] + Kj) % 0x100000000) + e |
a = ROL(sj, (a + Fj(b, c, d) + X[rj] + Kj) % 0x100000000) + e |
||||||
c = ROL(10, c) |
c = ROL(10, c) |
||||||
return a % 0x100000000, c |
return a % 0x100000000, c |
||||||
|
|
||||||
PADDING = [0x80] + [0]*63 |
PADDING = [0x80] + [0]*63 |
||||||
|
|
||||||
import sys |
import sys |
||||||
import struct |
import struct |
||||||
|
|
||||||
def RMD160Transform(state, block): #uint32 state[5], uchar block[64] |
def RMD160Transform(state, block): #uint32 state[5], uchar block[64] |
||||||
x = [0]*16 |
x = [0]*16 |
||||||
if sys.byteorder == 'little': |
if sys.byteorder == 'little': |
||||||
x = struct.unpack('<16L', bytes([x for x in block[0:64]])) |
x = struct.unpack('<16L', bytes([x for x in block[0:64]])) |
||||||
else: |
else: |
||||||
raise "Error!!" |
raise "Error!!" |
||||||
a = state[0] |
a = state[0] |
||||||
b = state[1] |
b = state[1] |
||||||
c = state[2] |
c = state[2] |
||||||
d = state[3] |
d = state[3] |
||||||
e = state[4] |
e = state[4] |
||||||
|
|
||||||
#/* Round 1 */ |
#/* Round 1 */ |
||||||
a, c = R(a, b, c, d, e, F0, K0, 11, 0, x); |
a, c = R(a, b, c, d, e, F0, K0, 11, 0, x); |
||||||
e, b = R(e, a, b, c, d, F0, K0, 14, 1, x); |
e, b = R(e, a, b, c, d, F0, K0, 14, 1, x); |
||||||
d, a = R(d, e, a, b, c, F0, K0, 15, 2, x); |
d, a = R(d, e, a, b, c, F0, K0, 15, 2, x); |
||||||
c, e = R(c, d, e, a, b, F0, K0, 12, 3, x); |
c, e = R(c, d, e, a, b, F0, K0, 12, 3, x); |
||||||
b, d = R(b, c, d, e, a, F0, K0, 5, 4, x); |
b, d = R(b, c, d, e, a, F0, K0, 5, 4, x); |
||||||
a, c = R(a, b, c, d, e, F0, K0, 8, 5, x); |
a, c = R(a, b, c, d, e, F0, K0, 8, 5, x); |
||||||
e, b = R(e, a, b, c, d, F0, K0, 7, 6, x); |
e, b = R(e, a, b, c, d, F0, K0, 7, 6, x); |
||||||
d, a = R(d, e, a, b, c, F0, K0, 9, 7, x); |
d, a = R(d, e, a, b, c, F0, K0, 9, 7, x); |
||||||
c, e = R(c, d, e, a, b, F0, K0, 11, 8, x); |
c, e = R(c, d, e, a, b, F0, K0, 11, 8, x); |
||||||
b, d = R(b, c, d, e, a, F0, K0, 13, 9, x); |
b, d = R(b, c, d, e, a, F0, K0, 13, 9, x); |
||||||
a, c = R(a, b, c, d, e, F0, K0, 14, 10, x); |
a, c = R(a, b, c, d, e, F0, K0, 14, 10, x); |
||||||
e, b = R(e, a, b, c, d, F0, K0, 15, 11, x); |
e, b = R(e, a, b, c, d, F0, K0, 15, 11, x); |
||||||
d, a = R(d, e, a, b, c, F0, K0, 6, 12, x); |
d, a = R(d, e, a, b, c, F0, K0, 6, 12, x); |
||||||
c, e = R(c, d, e, a, b, F0, K0, 7, 13, x); |
c, e = R(c, d, e, a, b, F0, K0, 7, 13, x); |
||||||
b, d = R(b, c, d, e, a, F0, K0, 9, 14, x); |
b, d = R(b, c, d, e, a, F0, K0, 9, 14, x); |
||||||
a, c = R(a, b, c, d, e, F0, K0, 8, 15, x); #/* #15 */ |
a, c = R(a, b, c, d, e, F0, K0, 8, 15, x); #/* #15 */ |
||||||
#/* Round 2 */ |
#/* Round 2 */ |
||||||
e, b = R(e, a, b, c, d, F1, K1, 7, 7, x); |
e, b = R(e, a, b, c, d, F1, K1, 7, 7, x); |
||||||
d, a = R(d, e, a, b, c, F1, K1, 6, 4, x); |
d, a = R(d, e, a, b, c, F1, K1, 6, 4, x); |
||||||
c, e = R(c, d, e, a, b, F1, K1, 8, 13, x); |
c, e = R(c, d, e, a, b, F1, K1, 8, 13, x); |
||||||
b, d = R(b, c, d, e, a, F1, K1, 13, 1, x); |
b, d = R(b, c, d, e, a, F1, K1, 13, 1, x); |
||||||
a, c = R(a, b, c, d, e, F1, K1, 11, 10, x); |
a, c = R(a, b, c, d, e, F1, K1, 11, 10, x); |
||||||
e, b = R(e, a, b, c, d, F1, K1, 9, 6, x); |
e, b = R(e, a, b, c, d, F1, K1, 9, 6, x); |
||||||
d, a = R(d, e, a, b, c, F1, K1, 7, 15, x); |
d, a = R(d, e, a, b, c, F1, K1, 7, 15, x); |
||||||
c, e = R(c, d, e, a, b, F1, K1, 15, 3, x); |
c, e = R(c, d, e, a, b, F1, K1, 15, 3, x); |
||||||
b, d = R(b, c, d, e, a, F1, K1, 7, 12, x); |
b, d = R(b, c, d, e, a, F1, K1, 7, 12, x); |
||||||
a, c = R(a, b, c, d, e, F1, K1, 12, 0, x); |
a, c = R(a, b, c, d, e, F1, K1, 12, 0, x); |
||||||
e, b = R(e, a, b, c, d, F1, K1, 15, 9, x); |
e, b = R(e, a, b, c, d, F1, K1, 15, 9, x); |
||||||
d, a = R(d, e, a, b, c, F1, K1, 9, 5, x); |
d, a = R(d, e, a, b, c, F1, K1, 9, 5, x); |
||||||
c, e = R(c, d, e, a, b, F1, K1, 11, 2, x); |
c, e = R(c, d, e, a, b, F1, K1, 11, 2, x); |
||||||
b, d = R(b, c, d, e, a, F1, K1, 7, 14, x); |
b, d = R(b, c, d, e, a, F1, K1, 7, 14, x); |
||||||
a, c = R(a, b, c, d, e, F1, K1, 13, 11, x); |
a, c = R(a, b, c, d, e, F1, K1, 13, 11, x); |
||||||
e, b = R(e, a, b, c, d, F1, K1, 12, 8, x); #/* #31 */ |
e, b = R(e, a, b, c, d, F1, K1, 12, 8, x); #/* #31 */ |
||||||
#/* Round 3 */ |
#/* Round 3 */ |
||||||
d, a = R(d, e, a, b, c, F2, K2, 11, 3, x); |
d, a = R(d, e, a, b, c, F2, K2, 11, 3, x); |
||||||
c, e = R(c, d, e, a, b, F2, K2, 13, 10, x); |
c, e = R(c, d, e, a, b, F2, K2, 13, 10, x); |
||||||
b, d = R(b, c, d, e, a, F2, K2, 6, 14, x); |
b, d = R(b, c, d, e, a, F2, K2, 6, 14, x); |
||||||
a, c = R(a, b, c, d, e, F2, K2, 7, 4, x); |
a, c = R(a, b, c, d, e, F2, K2, 7, 4, x); |
||||||
e, b = R(e, a, b, c, d, F2, K2, 14, 9, x); |
e, b = R(e, a, b, c, d, F2, K2, 14, 9, x); |
||||||
d, a = R(d, e, a, b, c, F2, K2, 9, 15, x); |
d, a = R(d, e, a, b, c, F2, K2, 9, 15, x); |
||||||
c, e = R(c, d, e, a, b, F2, K2, 13, 8, x); |
c, e = R(c, d, e, a, b, F2, K2, 13, 8, x); |
||||||
b, d = R(b, c, d, e, a, F2, K2, 15, 1, x); |
b, d = R(b, c, d, e, a, F2, K2, 15, 1, x); |
||||||
a, c = R(a, b, c, d, e, F2, K2, 14, 2, x); |
a, c = R(a, b, c, d, e, F2, K2, 14, 2, x); |
||||||
e, b = R(e, a, b, c, d, F2, K2, 8, 7, x); |
e, b = R(e, a, b, c, d, F2, K2, 8, 7, x); |
||||||
d, a = R(d, e, a, b, c, F2, K2, 13, 0, x); |
d, a = R(d, e, a, b, c, F2, K2, 13, 0, x); |
||||||
c, e = R(c, d, e, a, b, F2, K2, 6, 6, x); |
c, e = R(c, d, e, a, b, F2, K2, 6, 6, x); |
||||||
b, d = R(b, c, d, e, a, F2, K2, 5, 13, x); |
b, d = R(b, c, d, e, a, F2, K2, 5, 13, x); |
||||||
a, c = R(a, b, c, d, e, F2, K2, 12, 11, x); |
a, c = R(a, b, c, d, e, F2, K2, 12, 11, x); |
||||||
e, b = R(e, a, b, c, d, F2, K2, 7, 5, x); |
e, b = R(e, a, b, c, d, F2, K2, 7, 5, x); |
||||||
d, a = R(d, e, a, b, c, F2, K2, 5, 12, x); #/* #47 */ |
d, a = R(d, e, a, b, c, F2, K2, 5, 12, x); #/* #47 */ |
||||||
#/* Round 4 */ |
#/* Round 4 */ |
||||||
c, e = R(c, d, e, a, b, F3, K3, 11, 1, x); |
c, e = R(c, d, e, a, b, F3, K3, 11, 1, x); |
||||||
b, d = R(b, c, d, e, a, F3, K3, 12, 9, x); |
b, d = R(b, c, d, e, a, F3, K3, 12, 9, x); |
||||||
a, c = R(a, b, c, d, e, F3, K3, 14, 11, x); |
a, c = R(a, b, c, d, e, F3, K3, 14, 11, x); |
||||||
e, b = R(e, a, b, c, d, F3, K3, 15, 10, x); |
e, b = R(e, a, b, c, d, F3, K3, 15, 10, x); |
||||||
d, a = R(d, e, a, b, c, F3, K3, 14, 0, x); |
d, a = R(d, e, a, b, c, F3, K3, 14, 0, x); |
||||||
c, e = R(c, d, e, a, b, F3, K3, 15, 8, x); |
c, e = R(c, d, e, a, b, F3, K3, 15, 8, x); |
||||||
b, d = R(b, c, d, e, a, F3, K3, 9, 12, x); |
b, d = R(b, c, d, e, a, F3, K3, 9, 12, x); |
||||||
a, c = R(a, b, c, d, e, F3, K3, 8, 4, x); |
a, c = R(a, b, c, d, e, F3, K3, 8, 4, x); |
||||||
e, b = R(e, a, b, c, d, F3, K3, 9, 13, x); |
e, b = R(e, a, b, c, d, F3, K3, 9, 13, x); |
||||||
d, a = R(d, e, a, b, c, F3, K3, 14, 3, x); |
d, a = R(d, e, a, b, c, F3, K3, 14, 3, x); |
||||||
c, e = R(c, d, e, a, b, F3, K3, 5, 7, x); |
c, e = R(c, d, e, a, b, F3, K3, 5, 7, x); |
||||||
b, d = R(b, c, d, e, a, F3, K3, 6, 15, x); |
b, d = R(b, c, d, e, a, F3, K3, 6, 15, x); |
||||||
a, c = R(a, b, c, d, e, F3, K3, 8, 14, x); |
a, c = R(a, b, c, d, e, F3, K3, 8, 14, x); |
||||||
e, b = R(e, a, b, c, d, F3, K3, 6, 5, x); |
e, b = R(e, a, b, c, d, F3, K3, 6, 5, x); |
||||||
d, a = R(d, e, a, b, c, F3, K3, 5, 6, x); |
d, a = R(d, e, a, b, c, F3, K3, 5, 6, x); |
||||||
c, e = R(c, d, e, a, b, F3, K3, 12, 2, x); #/* #63 */ |
c, e = R(c, d, e, a, b, F3, K3, 12, 2, x); #/* #63 */ |
||||||
#/* Round 5 */ |
#/* Round 5 */ |
||||||
b, d = R(b, c, d, e, a, F4, K4, 9, 4, x); |
b, d = R(b, c, d, e, a, F4, K4, 9, 4, x); |
||||||
a, c = R(a, b, c, d, e, F4, K4, 15, 0, x); |
a, c = R(a, b, c, d, e, F4, K4, 15, 0, x); |
||||||
e, b = R(e, a, b, c, d, F4, K4, 5, 5, x); |
e, b = R(e, a, b, c, d, F4, K4, 5, 5, x); |
||||||
d, a = R(d, e, a, b, c, F4, K4, 11, 9, x); |
d, a = R(d, e, a, b, c, F4, K4, 11, 9, x); |
||||||
c, e = R(c, d, e, a, b, F4, K4, 6, 7, x); |
c, e = R(c, d, e, a, b, F4, K4, 6, 7, x); |
||||||
b, d = R(b, c, d, e, a, F4, K4, 8, 12, x); |
b, d = R(b, c, d, e, a, F4, K4, 8, 12, x); |
||||||
a, c = R(a, b, c, d, e, F4, K4, 13, 2, x); |
a, c = R(a, b, c, d, e, F4, K4, 13, 2, x); |
||||||
e, b = R(e, a, b, c, d, F4, K4, 12, 10, x); |
e, b = R(e, a, b, c, d, F4, K4, 12, 10, x); |
||||||
d, a = R(d, e, a, b, c, F4, K4, 5, 14, x); |
d, a = R(d, e, a, b, c, F4, K4, 5, 14, x); |
||||||
c, e = R(c, d, e, a, b, F4, K4, 12, 1, x); |
c, e = R(c, d, e, a, b, F4, K4, 12, 1, x); |
||||||
b, d = R(b, c, d, e, a, F4, K4, 13, 3, x); |
b, d = R(b, c, d, e, a, F4, K4, 13, 3, x); |
||||||
a, c = R(a, b, c, d, e, F4, K4, 14, 8, x); |
a, c = R(a, b, c, d, e, F4, K4, 14, 8, x); |
||||||
e, b = R(e, a, b, c, d, F4, K4, 11, 11, x); |
e, b = R(e, a, b, c, d, F4, K4, 11, 11, x); |
||||||
d, a = R(d, e, a, b, c, F4, K4, 8, 6, x); |
d, a = R(d, e, a, b, c, F4, K4, 8, 6, x); |
||||||
c, e = R(c, d, e, a, b, F4, K4, 5, 15, x); |
c, e = R(c, d, e, a, b, F4, K4, 5, 15, x); |
||||||
b, d = R(b, c, d, e, a, F4, K4, 6, 13, x); #/* #79 */ |
b, d = R(b, c, d, e, a, F4, K4, 6, 13, x); #/* #79 */ |
||||||
|
|
||||||
aa = a; |
aa = a; |
||||||
bb = b; |
bb = b; |
||||||
cc = c; |
cc = c; |
||||||
dd = d; |
dd = d; |
||||||
ee = e; |
ee = e; |
||||||
|
|
||||||
a = state[0] |
a = state[0] |
||||||
b = state[1] |
b = state[1] |
||||||
c = state[2] |
c = state[2] |
||||||
d = state[3] |
d = state[3] |
||||||
e = state[4] |
e = state[4] |
||||||
|
|
||||||
#/* Parallel round 1 */ |
#/* Parallel round 1 */ |
||||||
a, c = R(a, b, c, d, e, F4, KK0, 8, 5, x) |
a, c = R(a, b, c, d, e, F4, KK0, 8, 5, x) |
||||||
e, b = R(e, a, b, c, d, F4, KK0, 9, 14, x) |
e, b = R(e, a, b, c, d, F4, KK0, 9, 14, x) |
||||||
d, a = R(d, e, a, b, c, F4, KK0, 9, 7, x) |
d, a = R(d, e, a, b, c, F4, KK0, 9, 7, x) |
||||||
c, e = R(c, d, e, a, b, F4, KK0, 11, 0, x) |
c, e = R(c, d, e, a, b, F4, KK0, 11, 0, x) |
||||||
b, d = R(b, c, d, e, a, F4, KK0, 13, 9, x) |
b, d = R(b, c, d, e, a, F4, KK0, 13, 9, x) |
||||||
a, c = R(a, b, c, d, e, F4, KK0, 15, 2, x) |
a, c = R(a, b, c, d, e, F4, KK0, 15, 2, x) |
||||||
e, b = R(e, a, b, c, d, F4, KK0, 15, 11, x) |
e, b = R(e, a, b, c, d, F4, KK0, 15, 11, x) |
||||||
d, a = R(d, e, a, b, c, F4, KK0, 5, 4, x) |
d, a = R(d, e, a, b, c, F4, KK0, 5, 4, x) |
||||||
c, e = R(c, d, e, a, b, F4, KK0, 7, 13, x) |
c, e = R(c, d, e, a, b, F4, KK0, 7, 13, x) |
||||||
b, d = R(b, c, d, e, a, F4, KK0, 7, 6, x) |
b, d = R(b, c, d, e, a, F4, KK0, 7, 6, x) |
||||||
a, c = R(a, b, c, d, e, F4, KK0, 8, 15, x) |
a, c = R(a, b, c, d, e, F4, KK0, 8, 15, x) |
||||||
e, b = R(e, a, b, c, d, F4, KK0, 11, 8, x) |
e, b = R(e, a, b, c, d, F4, KK0, 11, 8, x) |
||||||
d, a = R(d, e, a, b, c, F4, KK0, 14, 1, x) |
d, a = R(d, e, a, b, c, F4, KK0, 14, 1, x) |
||||||
c, e = R(c, d, e, a, b, F4, KK0, 14, 10, x) |
c, e = R(c, d, e, a, b, F4, KK0, 14, 10, x) |
||||||
b, d = R(b, c, d, e, a, F4, KK0, 12, 3, x) |
b, d = R(b, c, d, e, a, F4, KK0, 12, 3, x) |
||||||
a, c = R(a, b, c, d, e, F4, KK0, 6, 12, x) #/* #15 */ |
a, c = R(a, b, c, d, e, F4, KK0, 6, 12, x) #/* #15 */ |
||||||
#/* Parallel round 2 */ |
#/* Parallel round 2 */ |
||||||
e, b = R(e, a, b, c, d, F3, KK1, 9, 6, x) |
e, b = R(e, a, b, c, d, F3, KK1, 9, 6, x) |
||||||
d, a = R(d, e, a, b, c, F3, KK1, 13, 11, x) |
d, a = R(d, e, a, b, c, F3, KK1, 13, 11, x) |
||||||
c, e = R(c, d, e, a, b, F3, KK1, 15, 3, x) |
c, e = R(c, d, e, a, b, F3, KK1, 15, 3, x) |
||||||
b, d = R(b, c, d, e, a, F3, KK1, 7, 7, x) |
b, d = R(b, c, d, e, a, F3, KK1, 7, 7, x) |
||||||
a, c = R(a, b, c, d, e, F3, KK1, 12, 0, x) |
a, c = R(a, b, c, d, e, F3, KK1, 12, 0, x) |
||||||
e, b = R(e, a, b, c, d, F3, KK1, 8, 13, x) |
e, b = R(e, a, b, c, d, F3, KK1, 8, 13, x) |
||||||
d, a = R(d, e, a, b, c, F3, KK1, 9, 5, x) |
d, a = R(d, e, a, b, c, F3, KK1, 9, 5, x) |
||||||
c, e = R(c, d, e, a, b, F3, KK1, 11, 10, x) |
c, e = R(c, d, e, a, b, F3, KK1, 11, 10, x) |
||||||
b, d = R(b, c, d, e, a, F3, KK1, 7, 14, x) |
b, d = R(b, c, d, e, a, F3, KK1, 7, 14, x) |
||||||
a, c = R(a, b, c, d, e, F3, KK1, 7, 15, x) |
a, c = R(a, b, c, d, e, F3, KK1, 7, 15, x) |
||||||
e, b = R(e, a, b, c, d, F3, KK1, 12, 8, x) |
e, b = R(e, a, b, c, d, F3, KK1, 12, 8, x) |
||||||
d, a = R(d, e, a, b, c, F3, KK1, 7, 12, x) |
d, a = R(d, e, a, b, c, F3, KK1, 7, 12, x) |
||||||
c, e = R(c, d, e, a, b, F3, KK1, 6, 4, x) |
c, e = R(c, d, e, a, b, F3, KK1, 6, 4, x) |
||||||
b, d = R(b, c, d, e, a, F3, KK1, 15, 9, x) |
b, d = R(b, c, d, e, a, F3, KK1, 15, 9, x) |
||||||
a, c = R(a, b, c, d, e, F3, KK1, 13, 1, x) |
a, c = R(a, b, c, d, e, F3, KK1, 13, 1, x) |
||||||
e, b = R(e, a, b, c, d, F3, KK1, 11, 2, x) #/* #31 */ |
e, b = R(e, a, b, c, d, F3, KK1, 11, 2, x) #/* #31 */ |
||||||
#/* Parallel round 3 */ |
#/* Parallel round 3 */ |
||||||
d, a = R(d, e, a, b, c, F2, KK2, 9, 15, x) |
d, a = R(d, e, a, b, c, F2, KK2, 9, 15, x) |
||||||
c, e = R(c, d, e, a, b, F2, KK2, 7, 5, x) |
c, e = R(c, d, e, a, b, F2, KK2, 7, 5, x) |
||||||
b, d = R(b, c, d, e, a, F2, KK2, 15, 1, x) |
b, d = R(b, c, d, e, a, F2, KK2, 15, 1, x) |
||||||
a, c = R(a, b, c, d, e, F2, KK2, 11, 3, x) |
a, c = R(a, b, c, d, e, F2, KK2, 11, 3, x) |
||||||
e, b = R(e, a, b, c, d, F2, KK2, 8, 7, x) |
e, b = R(e, a, b, c, d, F2, KK2, 8, 7, x) |
||||||
d, a = R(d, e, a, b, c, F2, KK2, 6, 14, x) |
d, a = R(d, e, a, b, c, F2, KK2, 6, 14, x) |
||||||
c, e = R(c, d, e, a, b, F2, KK2, 6, 6, x) |
c, e = R(c, d, e, a, b, F2, KK2, 6, 6, x) |
||||||
b, d = R(b, c, d, e, a, F2, KK2, 14, 9, x) |
b, d = R(b, c, d, e, a, F2, KK2, 14, 9, x) |
||||||
a, c = R(a, b, c, d, e, F2, KK2, 12, 11, x) |
a, c = R(a, b, c, d, e, F2, KK2, 12, 11, x) |
||||||
e, b = R(e, a, b, c, d, F2, KK2, 13, 8, x) |
e, b = R(e, a, b, c, d, F2, KK2, 13, 8, x) |
||||||
d, a = R(d, e, a, b, c, F2, KK2, 5, 12, x) |
d, a = R(d, e, a, b, c, F2, KK2, 5, 12, x) |
||||||
c, e = R(c, d, e, a, b, F2, KK2, 14, 2, x) |
c, e = R(c, d, e, a, b, F2, KK2, 14, 2, x) |
||||||
b, d = R(b, c, d, e, a, F2, KK2, 13, 10, x) |
b, d = R(b, c, d, e, a, F2, KK2, 13, 10, x) |
||||||
a, c = R(a, b, c, d, e, F2, KK2, 13, 0, x) |
a, c = R(a, b, c, d, e, F2, KK2, 13, 0, x) |
||||||
e, b = R(e, a, b, c, d, F2, KK2, 7, 4, x) |
e, b = R(e, a, b, c, d, F2, KK2, 7, 4, x) |
||||||
d, a = R(d, e, a, b, c, F2, KK2, 5, 13, x) #/* #47 */ |
d, a = R(d, e, a, b, c, F2, KK2, 5, 13, x) #/* #47 */ |
||||||
#/* Parallel round 4 */ |
#/* Parallel round 4 */ |
||||||
c, e = R(c, d, e, a, b, F1, KK3, 15, 8, x) |
c, e = R(c, d, e, a, b, F1, KK3, 15, 8, x) |
||||||
b, d = R(b, c, d, e, a, F1, KK3, 5, 6, x) |
b, d = R(b, c, d, e, a, F1, KK3, 5, 6, x) |
||||||
a, c = R(a, b, c, d, e, F1, KK3, 8, 4, x) |
a, c = R(a, b, c, d, e, F1, KK3, 8, 4, x) |
||||||
e, b = R(e, a, b, c, d, F1, KK3, 11, 1, x) |
e, b = R(e, a, b, c, d, F1, KK3, 11, 1, x) |
||||||
d, a = R(d, e, a, b, c, F1, KK3, 14, 3, x) |
d, a = R(d, e, a, b, c, F1, KK3, 14, 3, x) |
||||||
c, e = R(c, d, e, a, b, F1, KK3, 14, 11, x) |
c, e = R(c, d, e, a, b, F1, KK3, 14, 11, x) |
||||||
b, d = R(b, c, d, e, a, F1, KK3, 6, 15, x) |
b, d = R(b, c, d, e, a, F1, KK3, 6, 15, x) |
||||||
a, c = R(a, b, c, d, e, F1, KK3, 14, 0, x) |
a, c = R(a, b, c, d, e, F1, KK3, 14, 0, x) |
||||||
e, b = R(e, a, b, c, d, F1, KK3, 6, 5, x) |
e, b = R(e, a, b, c, d, F1, KK3, 6, 5, x) |
||||||
d, a = R(d, e, a, b, c, F1, KK3, 9, 12, x) |
d, a = R(d, e, a, b, c, F1, KK3, 9, 12, x) |
||||||
c, e = R(c, d, e, a, b, F1, KK3, 12, 2, x) |
c, e = R(c, d, e, a, b, F1, KK3, 12, 2, x) |
||||||
b, d = R(b, c, d, e, a, F1, KK3, 9, 13, x) |
b, d = R(b, c, d, e, a, F1, KK3, 9, 13, x) |
||||||
a, c = R(a, b, c, d, e, F1, KK3, 12, 9, x) |
a, c = R(a, b, c, d, e, F1, KK3, 12, 9, x) |
||||||
e, b = R(e, a, b, c, d, F1, KK3, 5, 7, x) |
e, b = R(e, a, b, c, d, F1, KK3, 5, 7, x) |
||||||
d, a = R(d, e, a, b, c, F1, KK3, 15, 10, x) |
d, a = R(d, e, a, b, c, F1, KK3, 15, 10, x) |
||||||
c, e = R(c, d, e, a, b, F1, KK3, 8, 14, x) #/* #63 */ |
c, e = R(c, d, e, a, b, F1, KK3, 8, 14, x) #/* #63 */ |
||||||
#/* Parallel round 5 */ |
#/* Parallel round 5 */ |
||||||
b, d = R(b, c, d, e, a, F0, KK4, 8, 12, x) |
b, d = R(b, c, d, e, a, F0, KK4, 8, 12, x) |
||||||
a, c = R(a, b, c, d, e, F0, KK4, 5, 15, x) |
a, c = R(a, b, c, d, e, F0, KK4, 5, 15, x) |
||||||
e, b = R(e, a, b, c, d, F0, KK4, 12, 10, x) |
e, b = R(e, a, b, c, d, F0, KK4, 12, 10, x) |
||||||
d, a = R(d, e, a, b, c, F0, KK4, 9, 4, x) |
d, a = R(d, e, a, b, c, F0, KK4, 9, 4, x) |
||||||
c, e = R(c, d, e, a, b, F0, KK4, 12, 1, x) |
c, e = R(c, d, e, a, b, F0, KK4, 12, 1, x) |
||||||
b, d = R(b, c, d, e, a, F0, KK4, 5, 5, x) |
b, d = R(b, c, d, e, a, F0, KK4, 5, 5, x) |
||||||
a, c = R(a, b, c, d, e, F0, KK4, 14, 8, x) |
a, c = R(a, b, c, d, e, F0, KK4, 14, 8, x) |
||||||
e, b = R(e, a, b, c, d, F0, KK4, 6, 7, x) |
e, b = R(e, a, b, c, d, F0, KK4, 6, 7, x) |
||||||
d, a = R(d, e, a, b, c, F0, KK4, 8, 6, x) |
d, a = R(d, e, a, b, c, F0, KK4, 8, 6, x) |
||||||
c, e = R(c, d, e, a, b, F0, KK4, 13, 2, x) |
c, e = R(c, d, e, a, b, F0, KK4, 13, 2, x) |
||||||
b, d = R(b, c, d, e, a, F0, KK4, 6, 13, x) |
b, d = R(b, c, d, e, a, F0, KK4, 6, 13, x) |
||||||
a, c = R(a, b, c, d, e, F0, KK4, 5, 14, x) |
a, c = R(a, b, c, d, e, F0, KK4, 5, 14, x) |
||||||
e, b = R(e, a, b, c, d, F0, KK4, 15, 0, x) |
e, b = R(e, a, b, c, d, F0, KK4, 15, 0, x) |
||||||
d, a = R(d, e, a, b, c, F0, KK4, 13, 3, x) |
d, a = R(d, e, a, b, c, F0, KK4, 13, 3, x) |
||||||
c, e = R(c, d, e, a, b, F0, KK4, 11, 9, x) |
c, e = R(c, d, e, a, b, F0, KK4, 11, 9, x) |
||||||
b, d = R(b, c, d, e, a, F0, KK4, 11, 11, x) #/* #79 */ |
b, d = R(b, c, d, e, a, F0, KK4, 11, 11, x) #/* #79 */ |
||||||
|
|
||||||
t = (state[1] + cc + d) % 0x100000000; |
t = (state[1] + cc + d) % 0x100000000; |
||||||
state[1] = (state[2] + dd + e) % 0x100000000; |
state[1] = (state[2] + dd + e) % 0x100000000; |
||||||
state[2] = (state[3] + ee + a) % 0x100000000; |
state[2] = (state[3] + ee + a) % 0x100000000; |
||||||
state[3] = (state[4] + aa + b) % 0x100000000; |
state[3] = (state[4] + aa + b) % 0x100000000; |
||||||
state[4] = (state[0] + bb + c) % 0x100000000; |
state[4] = (state[0] + bb + c) % 0x100000000; |
||||||
state[0] = t % 0x100000000; |
state[0] = t % 0x100000000; |
||||||
|
|
||||||
pass |
pass |
||||||
|
|
||||||
|
|
||||||
def RMD160Update(ctx, inp, inplen): |
def RMD160Update(ctx, inp, inplen): |
||||||
if type(inp) == str: |
if type(inp) == str: |
||||||
inp = [ord(i)&0xff for i in inp] |
inp = [ord(i)&0xff for i in inp] |
||||||
|
|
||||||
have = (ctx.count // 8) % 64 |
have = (ctx.count // 8) % 64 |
||||||
need = 64 - have |
need = 64 - have |
||||||
ctx.count += 8 * inplen |
ctx.count += 8 * inplen |
||||||
off = 0 |
off = 0 |
||||||
if inplen >= need: |
if inplen >= need: |
||||||
if have: |
if have: |
||||||
for i in range(need): |
for i in range(need): |
||||||
ctx.buffer[have+i] = inp[i] |
ctx.buffer[have+i] = inp[i] |
||||||
RMD160Transform(ctx.state, ctx.buffer) |
RMD160Transform(ctx.state, ctx.buffer) |
||||||
off = need |
off = need |
||||||
have = 0 |
have = 0 |
||||||
while off + 64 <= inplen: |
while off + 64 <= inplen: |
||||||
RMD160Transform(ctx.state, inp[off:]) #<--- |
RMD160Transform(ctx.state, inp[off:]) #<--- |
||||||
off += 64 |
off += 64 |
||||||
if off < inplen: |
if off < inplen: |
||||||
# memcpy(ctx->buffer + have, input+off, len-off); |
# memcpy(ctx->buffer + have, input+off, len-off); |
||||||
for i in range(inplen - off): |
for i in range(inplen - off): |
||||||
ctx.buffer[have+i] = inp[off+i] |
ctx.buffer[have+i] = inp[off+i] |
||||||
|
|
||||||
def RMD160Final(ctx): |
def RMD160Final(ctx): |
||||||
size = struct.pack("<Q", ctx.count) |
size = struct.pack("<Q", ctx.count) |
||||||
padlen = 64 - ((ctx.count // 8) % 64) |
padlen = 64 - ((ctx.count // 8) % 64) |
||||||
if padlen < 1+8: |
if padlen < 1+8: |
||||||
padlen += 64 |
padlen += 64 |
||||||
RMD160Update(ctx, PADDING, padlen-8) |
RMD160Update(ctx, PADDING, padlen-8) |
||||||
RMD160Update(ctx, size, 8) |
RMD160Update(ctx, size, 8) |
||||||
return struct.pack("<5L", *ctx.state) |
return struct.pack("<5L", *ctx.state) |
||||||
|
|
||||||
|
|
||||||
assert '37f332f68db77bd9d7edd4969571ad671cf9dd3b' == \ |
assert '37f332f68db77bd9d7edd4969571ad671cf9dd3b' == \ |
||||||
new(b'The quick brown fox jumps over the lazy dog').hexdigest() |
new(b'The quick brown fox jumps over the lazy dog').hexdigest() |
||||||
assert '132072df690933835eb8b6ad0b77e7b6f14acad7' == \ |
assert '132072df690933835eb8b6ad0b77e7b6f14acad7' == \ |
||||||
new(b'The quick brown fox jumps over the lazy cog').hexdigest() |
new(b'The quick brown fox jumps over the lazy cog').hexdigest() |
||||||
assert '9c1185a5c5e9fc54612808977ee8f548b2258d31' == \ |
assert '9c1185a5c5e9fc54612808977ee8f548b2258d31' == \ |
||||||
new('').hexdigest() |
new('').hexdigest() |
||||||
|
|||||||
Loading…
Reference in new issue