GithubHelp home page GithubHelp logo

hutorny / chaskey Goto Github PK

View Code? Open in Web Editor NEW
12.0 5.0 9.0 116 KB

A lightweight 128-bit encryption algorithm implemented in C++ and JavaScript

License: MIT License

C 4.52% C++ 70.97% JavaScript 22.02% HTML 2.49%
cryptography cbc-mode mac-mode cipher embedded mcu arduino arm cortex-m chaskey

chaskey's People

Contributors

hutorny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

chaskey's Issues

Chaskey is never claimed to be a cipher.

While Chaskey is it self constructed as CMAC/OMAC with EvanMansour block cipher, afaik it was never claimed its building block (EM block cipher) is safe to be used as standalone building block for encryption. More over, cryptoanalyzes have sentences about "attaker has no way for chosen ciphertext attack".

May be I'm missing something? Can you point on investigations?

Wrong result if an instance is reused with a shorter message length

var mac = new ChaskeyCipher.Mac();	// instantiate a cipher in MAC mode
mac.set([1,2,3,4]);			// set the key
console.log(mac.sign(new Uint8Array(0))); 
console.log(mac.sign(new Uint8Array(0)));
console.log(mac.sign(new Uint8Array(17)));
console.log(mac.sign(new Uint8Array(0)));

prints the following:

Uint8Array(16) [164, 51, 219, 196, 236, 190, 42, 255, 44, 145, 84, 85, 202, 211, 40, 178]
Uint8Array(16) [164, 51, 219, 196, 236, 190, 42, 255, 44, 145, 84, 85, 202, 211, 40, 178]
Uint8Array(16) [206, 55, 154, 136, 95, 96, 215, 4, 30, 37, 59, 16, 223, 175, 215, 176]
Uint8Array(16) [89, 208, 133, 178, 254, 56, 60, 179, 61, 217, 110, 222, 43, 11, 187, 61]

I expect the last line to be

Uint8Array(16) [164, 51, 219, 196, 236, 190, 42, 255, 44, 145, 84, 85, 202, 211, 40, 178]

The reason is that the formatter object's byte buffer is not reset completely upon reset. It is filled with zeros instead of truncated to zero length.

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.