Skip to content

Commit

Permalink
Trimmed back to just SHA-1 functions (to fit on Uno R2)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintYourDragon committed Jul 18, 2013
1 parent 42d2ba3 commit e688052
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 657 deletions.
59 changes: 8 additions & 51 deletions README
@@ -1,56 +1,13 @@
Cryptosuite is a cryptographic library for Arduino (including SHA and HMAC-SHA)
This is a trimmed-down version of Peter Knight's excellent Cryptosuite library for Arduino, supporting secure hashing and hashed message authentication using SHA-1 and HMAC-SHA-1.

It currently supports secure hashing and hashed message authentication using SHA-1, SHA-256, HMAC-SHA-1 and HMAC-SHA-256.
To help fit complex applications within the limited code space of the Arduino, this version strips out the SHA-256 functionality -- it wasn't required of our OAuth-driven code. If you specifically require this capability (and can afford the extra program space), download the original full version of the library here:

Installation:
Make a 'libraries' directory with your Arduino sketches folder if you do not already have one.
Copy the 'Sha' directory into that directory.
Restart Arduino to rescan for new libraries.

Using SHA-1:
#include "sha1.h"
...
uint8_t *hash;
Sha1.init();
Sha1.print("This is a message to hash");
hash = Sha1.result();

The hash result is then stored in hash[0], hash[1] .. hash[19].

Using HMAC-SHA-1:
#include "sha1.h"
...
uint8_t *hash;
Sha1.initHmac("hash key",8); // key, and length of key in bytes
Sha1.print("This is a message to hash");
hash = Sha1.resultHmac();

The hash result is then stored in hash[0], hash[1] .. hash[19].
https://github.com/Cathedrow/Cryptosuite

Using SHA-256:
#include "sha256.h"
...
uint8_t *hash;
Sha256.init();
Sha256.print("This is a message to hash");
hash = Sha256.result();
The original also contains a test suite and further exposition on the use of hash functions.

The hash result is then stored in hash[0], hash[1] .. hash[31].

Using HMAC-SHA-256:
#include "sha256.h"
...
uint8_t *hash;
Sha256.initHmac("hash key",8); // key, and length of key in bytes
Sha256.print("This is a message to hash");
hash = Sha256.resultHmac();

The hash result is then stored in hash[0], hash[1] .. hash[31].


Verification:
The provided example code tests against published test vectors.
SHA-1: FIPS 180-2, RFC3174 compliant
HMAC-SHA-1: FIPS 198a compliant
SHA-256: FIPS 180-2, RFC4231 compliant
HMAC-SHA-256: RFC4231 compliant
Installation:
Make a 'libraries' directory with your Arduino sketches folder if you do not already have one.
Rename this folder 'Sha' and move it into that directory.
Restart Arduino IDE to rescan for new libraries.
102 changes: 0 additions & 102 deletions Sha/examples/hmacsha256test/hmacsha256test.pde

This file was deleted.

113 changes: 0 additions & 113 deletions Sha/examples/sha1test/sha1test.pde

This file was deleted.

0 comments on commit e688052

Please sign in to comment.