Git Product home page Git Product logo

xoocycle's Introduction

Xoocycle

Xoocycle is an implementation of the Keccak Team's Xoodyak hash and AEAD construction in under 275 lines of standard C, compatible with C90 and later versions.

This code has not been audited, either for general integrity, cryptographic suitability, or compliance to the Xoodyak specification. It does pass the Xoodyak test vectors, and has been analysed with Flawfinder, Splint, Infer, Clang SA, and Valgrind to protect against some trivial errors. Only little-endian platforms are supported.

The header file xoocycle.h defines twenty exported names, seventeen of which use the standard prefix xoocycle. The remaining three are the modern type names u8, u32, and size.

The code is available under the Apache License 2.0.

Xoodyak examples

The file xoohash.c is a full script that takes the Xoodyak-256 hash of stdin. The file xootest.c contains an AEAD example. This is an excerpt from the former script:

  xoocycle_cyclist(&cyc, xoocycle_empty, 0, xoocycle_empty, 0,
                   xoocycle_empty, 0);
  while (1) {
    len = read(STDIN_FILENO, io, IO);
    if (len < 0) {
      fprintf(stderr, "error\n");
      exit(EXIT_FAILURE);
    }
    if (len == 0) {
      break;
    }
    xoocycle_absorb(&cyc, io, len);
  }
  xoocycle_squeeze(&cyc, io, HASH);
  print8(io, HASH);
  xoocycle_erase(&cyc);

When xoohash.c is run on itself, it produces:

51f1608c0a2ccc73f72d3403e32414c2fcda33dc21a475b20d2c3e66081c4ee1

Acknowledgements

Xoodyak was created by the Keccak Team. The xoodoo32 permutation function in xoocycle.c is based on a public domain version by Odzhan.

xoocycle's People

Contributors

sbp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

safari77

xoocycle's Issues

Hashing large inputs

Hello! First off, thank you very much for this excellent implementation. With normal hash functions, you can of course do something like

hasher = hasher_new()
hasher_add(&hasher, "hello ")
hasher_add(&hasher, "world")
hasher_finish(&hasher, out)

Which normally would give the same output as:

hasher = hasher_new()
hasher_add(&hasher, "hello world")
hasher_finish(&hasher, out)

But this doesn't seem to work with xoocycle, as a hash produced by xoocycle using the first method is different from the second.

Is this to be expected from all xoodyak implementations, or is it xoocycle-specific? I saw a absorb_more function in Rust's implementation, but that doesn't seem to do it either, unless I'm missing something.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.