diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-06-17 00:42:07 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-06-17 00:42:07 +0200 |
commit | 938aa55a95fda70b403fa5cabb43c6cc37292ebf (patch) | |
tree | f77e74b2f02b38e35997182984ce2a05aeb146f3 | |
parent | m + fix for python version (diff) | |
download | sha3sum-938aa55a95fda70b403fa5cabb43c6cc37292ebf.tar.gz sha3sum-938aa55a95fda70b403fa5cabb43c6cc37292ebf.tar.bz2 sha3sum-938aa55a95fda70b403fa5cabb43c6cc37292ebf.tar.xz |
change defaults (conflicts with Wikipedia but is based on official Keccak defaults; no defaults have yet been standardised)
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | c/sha3sum.c | 6 | ||||
-rw-r--r-- | pure-java/sha3sum.java | 6 | ||||
-rwxr-xr-x | python3/sha3sum.py | 8 | ||||
-rw-r--r-- | vala/sha3sum.vala | 4 |
5 files changed, 19 insertions, 14 deletions
@@ -25,10 +25,10 @@ COMPLETE STATUS: *OPTIONS:* -r BITRATE - --bitrate The bitrate to use for SHA-3. (default: 576) + --bitrate The bitrate to use for SHA-3. (default: 1024) -c CAPACITY - --capacity The capacity to use for SHA-3. (default: 1024) + --capacity The capacity to use for SHA-3. (default: 576) -w WORDSIZE --wordsize The word size to use for SHA-3. (default: 64) @@ -55,6 +55,11 @@ COMPLETE STATUS: --multi Print the chechsum at all iterations. +Pending the standardisation of SHA-3, there is no specification of particular SHA-3 functions yet. +Our defaults are based on Keccak[] being Keccak[r = 1024, c = 576] rather than the functions in +Wikipedias entires that uses [r = 576, c = 1024]. + + If you want to contribute with an implementation in another language, please try do some in the earliest version of the language officially supported on GNU/Linux, unless there are diff --git a/c/sha3sum.c b/c/sha3sum.c index 8872f6d..a03f0c2 100644 --- a/c/sha3sum.c +++ b/c/sha3sum.c @@ -218,8 +218,8 @@ int main(int argc, char** argv) _o = 512; } _s = 1600; /* --statesize */ - _r = _s - (_o << 1); /* --bitrate */ - _c = _s - _r; /* --capacity */ + _c = _s - (_o << 1); /* --capacity */ + _r = _s - _c; /* --bitrate */ _w = _s / 25; /* --wordsize */ _i = 1; /* --iterations */ _j = 1; /* --squeezes */ @@ -479,7 +479,7 @@ int main(int argc, char** argv) if ((_R & _C & _O) == null) /* s? */ { s = _S ? s : _s; - r = -((c = (o = (((s << 5) / 100 + 7) >> 3) << 3) << 1) - s); + c = -((r = (o = (((s << 5) / 100 + 7) >> 3) << 3) << 1) - s); o = o < 8 ? 8 : o; } else if ((_R & _C) == null) /* !o s? */ diff --git a/pure-java/sha3sum.java b/pure-java/sha3sum.java index 783e41b..22427a5 100644 --- a/pure-java/sha3sum.java +++ b/pure-java/sha3sum.java @@ -61,8 +61,8 @@ public class sha3sum else if (cmd == "sha3-384sum") _o = 384; else if (cmd == "sha3-512sum") _o = 512; Integer S = null; int _s = 1600; /* --statesize */ - Integer R = null; int _r = _s - (_o << 1); /* --bitrate */ - Integer C = null; int _c = _s - _r; /* --capacity */ + Integer C = null; int _c = _s - (_o << 1); /* --capacity */ + Integer R = null; int _r = _s - _c; /* --bitrate */ Integer W = null; int _w = _s / 25; /* --wordsize */ Integer I = null; int _i = 1; /* --iterations */ Integer J = null; int _j = 1; /* --squeezes */ @@ -270,7 +270,7 @@ public class sha3sum if ((R == null) && (C == null) && (O == null)) // s? - { r = -((c = (o = ((((s = S == null ? _s : s) << 5) / 100 + 7) >> 3) << 3) << 1) - s); + { c = -((r = (o = ((((s = S == null ? _s : s) << 5) / 100 + 7) >> 3) << 3) << 1) - s); o = o < 8 ? 8 : o; } else if ((R == null) && (C == null)) // !o s? diff --git a/python3/sha3sum.py b/python3/sha3sum.py index ebb4c98..d388f1f 100755 --- a/python3/sha3sum.py +++ b/python3/sha3sum.py @@ -655,8 +655,8 @@ if __name__ == '__main__': elif cmd == 'sha3-384sum': _o = 384 elif cmd == 'sha3-512sum': _o = 512 _s = 1600 # --statesize - _r = _s - (_o << 1) # --bitrate - _c = _s - _r # --capacity + _c = _s - (_o << 1) # --capacity + _r = _s - _c # --bitrate _w = _s / 25 # --wordsize _i = 1 # --iterations _j = 1 # --squeezes @@ -834,8 +834,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. if (R is None) and (C is None) and (O is None): ## s? s = _s if S is None else s o = (((s << 5) // 100 + 7) >> 3) << 3 - c = o << 1 - r = s - c + r = o << 1 + c = s - r o = 8 if o < 8 else o elif (R is None) and (C is None): ## !o s? r = _r diff --git a/vala/sha3sum.vala b/vala/sha3sum.vala index 6339d6a..6aed7b0 100644 --- a/vala/sha3sum.vala +++ b/vala/sha3sum.vala @@ -635,8 +635,8 @@ static int main(string[] cmdargs) else if (cmd == "sha3-384sum") o = _o = 384; else if (cmd == "sha3-512sum") o = _o = 512; int _s, s = _s = 1600; /* --statesize */ - int _r, r = _r = s - (o << 1); /* --bitrate */ - int _c, c = _c = s - r; /* --capacity */ + int _c, c = _c = s - (o << 1); /* --capacity */ + int _r, r = _r = s - c; /* --bitrate */ int _w, w = _w = s / 25; /* --wordsize */ int _i, i = _i = 1; /* --iterations */ bool binary = false; |