From 6a48523fe26d863c815936912fac42bc2034459c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 13 Nov 2014 07:06:35 +0100 Subject: add commands for all variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/common.h | 3 +++ src/keccak-224sum.c | 30 ++++++++++++++++++++++++++++++ src/keccak-256sum.c | 30 ++++++++++++++++++++++++++++++ src/keccak-384sum.c | 30 ++++++++++++++++++++++++++++++ src/keccak-512sum.c | 30 ++++++++++++++++++++++++++++++ src/keccaksum.c | 1 - src/rawshake256sum.c | 30 ++++++++++++++++++++++++++++++ src/rawshake512sum.c | 30 ++++++++++++++++++++++++++++++ src/sha3-224sum.c | 30 ++++++++++++++++++++++++++++++ src/sha3-256sum.c | 30 ++++++++++++++++++++++++++++++ src/sha3-384sum.c | 30 ++++++++++++++++++++++++++++++ src/sha3-512sum.c | 30 ++++++++++++++++++++++++++++++ src/shake256sum.c | 30 ++++++++++++++++++++++++++++++ src/shake512sum.c | 30 ++++++++++++++++++++++++++++++ 14 files changed, 363 insertions(+), 1 deletion(-) create mode 100644 src/keccak-224sum.c create mode 100644 src/keccak-256sum.c create mode 100644 src/keccak-384sum.c create mode 100644 src/keccak-512sum.c create mode 100644 src/rawshake256sum.c create mode 100644 src/rawshake512sum.c create mode 100644 src/sha3-224sum.c create mode 100644 src/sha3-256sum.c create mode 100644 src/sha3-384sum.c create mode 100644 src/sha3-512sum.c create mode 100644 src/shake256sum.c create mode 100644 src/shake512sum.c diff --git a/src/common.h b/src/common.h index 7c35e3c..c90a9e4 100644 --- a/src/common.h +++ b/src/common.h @@ -24,6 +24,9 @@ #include +#define libkeccak_spec_keccak libkeccak_spec_sha3 + + /** * Wrapper for `run` that also initialises the command line parser diff --git a/src/keccak-224sum.c b/src/keccak-224sum.c new file mode 100644 index 0000000..ca6a415 --- /dev/null +++ b/src/keccak-224sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_keccak((libkeccak_spec_t*)&spec, 224); + return RUN("Keccak", "keccak-224sum", ""); +} + diff --git a/src/keccak-256sum.c b/src/keccak-256sum.c new file mode 100644 index 0000000..8e2b26b --- /dev/null +++ b/src/keccak-256sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_keccak((libkeccak_spec_t*)&spec, 256); + return RUN("Keccak", "keccak-256sum", ""); +} + diff --git a/src/keccak-384sum.c b/src/keccak-384sum.c new file mode 100644 index 0000000..f40ac77 --- /dev/null +++ b/src/keccak-384sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_keccak((libkeccak_spec_t*)&spec, 384); + return RUN("Keccak", "keccak-384sum", ""); +} + diff --git a/src/keccak-512sum.c b/src/keccak-512sum.c new file mode 100644 index 0000000..02ab126 --- /dev/null +++ b/src/keccak-512sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_keccak((libkeccak_spec_t*)&spec, 512); + return RUN("Keccak", "keccak-512sum", ""); +} + diff --git a/src/keccaksum.c b/src/keccaksum.c index 594fe77..1fea5ec 100644 --- a/src/keccaksum.c +++ b/src/keccaksum.c @@ -24,7 +24,6 @@ int main(int argc, char* argv[]) { libkeccak_generalised_spec_t spec; libkeccak_generalised_spec_initialise(&spec); - return RUN("Keccak", "keccaksum", ""); } diff --git a/src/rawshake256sum.c b/src/rawshake256sum.c new file mode 100644 index 0000000..7bd0100 --- /dev/null +++ b/src/rawshake256sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_rawshake((libkeccak_spec_t*)&spec, 256, 256); + return RUN("RawSHAKE", "rawshake256sum", LIBKECCAK_RAWSHAKE_SUFFIX); +} + diff --git a/src/rawshake512sum.c b/src/rawshake512sum.c new file mode 100644 index 0000000..cefb71d --- /dev/null +++ b/src/rawshake512sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_rawshake((libkeccak_spec_t*)&spec, 512, 512); + return RUN("RawSHAKE", "rawshake512sum", LIBKECCAK_RAWSHAKE_SUFFIX); +} + diff --git a/src/sha3-224sum.c b/src/sha3-224sum.c new file mode 100644 index 0000000..2ce1255 --- /dev/null +++ b/src/sha3-224sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_sha3((libkeccak_spec_t*)&spec, 224); + return RUN("SHA-3", "sha3-224sum", LIBKECCAK_SHA3_SUFFIX); +} + diff --git a/src/sha3-256sum.c b/src/sha3-256sum.c new file mode 100644 index 0000000..ec01211 --- /dev/null +++ b/src/sha3-256sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_sha3((libkeccak_spec_t*)&spec, 256); + return RUN("SHA-3", "sha3-256sum", LIBKECCAK_SHA3_SUFFIX); +} + diff --git a/src/sha3-384sum.c b/src/sha3-384sum.c new file mode 100644 index 0000000..ecac0ab --- /dev/null +++ b/src/sha3-384sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_sha3((libkeccak_spec_t*)&spec, 384); + return RUN("SHA-3", "sha3-384sum", LIBKECCAK_SHA3_SUFFIX); +} + diff --git a/src/sha3-512sum.c b/src/sha3-512sum.c new file mode 100644 index 0000000..c547c6c --- /dev/null +++ b/src/sha3-512sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_sha3((libkeccak_spec_t*)&spec, 512); + return RUN("SHA-3", "sha3-512sum", LIBKECCAK_SHA3_SUFFIX); +} + diff --git a/src/shake256sum.c b/src/shake256sum.c new file mode 100644 index 0000000..1645a53 --- /dev/null +++ b/src/shake256sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_shake((libkeccak_spec_t*)&spec, 256, 256); + return RUN("SHAKE", "shake256sum", LIBKECCAK_SHAKE_SUFFIX); +} + diff --git a/src/shake512sum.c b/src/shake512sum.c new file mode 100644 index 0000000..6cac04b --- /dev/null +++ b/src/shake512sum.c @@ -0,0 +1,30 @@ +/** + * sha3sum – SHA-3 (Keccak) checksum calculator + * + * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "common.h" + + + +int main(int argc, char* argv[]) +{ + libkeccak_generalised_spec_t spec; + libkeccak_generalised_spec_initialise(&spec); + libkeccak_spec_shake((libkeccak_spec_t*)&spec, 512, 512); + return RUN("SHAKE", "shake512sum", LIBKECCAK_SHAKE_SUFFIX); +} + -- cgit v1.2.3-70-g09d2