Coder Social home page Coder Social logo

cmcqueen / khazad-min Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 2.0 106 KB

Minimal Khazad encryption. Suitable for small embedded systems. Including on-the-fly key schedule calculation for minimal RAM usage.

License: MIT License

Shell 0.01% C 98.69% Python 0.64% Makefile 0.30% M4 0.37%
encryption embedded-systems khazad

khazad-min's Introduction

khazad-min

Minimal Khazad (Wikipedia) encryption.

For most applications, it makes more sense to use AES, since it is a well-known standard. Khazad might be useful for small embedded applications where a smaller encryption block size is desireable, e.g. for encrypting small radio messages.

This aims to be suitable for small embedded systems with limited RAM and ROM.

It includes optional on-the-fly key schedule calculation, for minimal RAM usage if required in a very RAM-constrained application. For systems with sufficient RAM, there is also encryption and decryption with a pre-calculated key schedule.

Normally the S-box implementation is by a simple 256-byte table look-up. An optional smaller S-box implementation is included for a very ROM-constrained application, where a 256-byte look-up table might be too big. This would only be expected to be necessary for especially tiny target applications, e.g. an automotive keyless entry remote.

Testing

Test programs are included, which test the S-box implementation and encrypt and decrypt operations.

Encryption and decryption are tested against the official test vectors. The test vectors were parsed and converted to C data structures using a Python program.

When using autotools, run the tests via:

make check

Most of the test vectors can be checked quickly, however the last set of vectors, set 4, involve 108 iterations of key schedule and encryption, so take some time to run. So the set 4 vectors are skipped by default. To run these tests, define the macro ENABLE_LONG_TEST in khazad-vectors-test.c. If using autotools, add the --enable-long-test configure option:

./configure --enable-long-test

License

This code is released under the MIT license. See LICENSE.txt for details.

khazad-min's People

Contributors

cmcqueen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.