Skip to content

Commit

Permalink
README.txt, Keywords & better functions description
Browse files Browse the repository at this point in the history
  • Loading branch information
abderraouf-adjal committed Dec 6, 2015
1 parent f9574d2 commit fcb3860
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 26 deletions.
78 changes: 53 additions & 25 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,59 @@ See <SpritzCipher.h> for the details.

* Types:
spritz_ctx
The context/ctx (contain the state), holds indices and S-Box.
# The context/ctx (contain the state), holds indices and S-Box.

* Functions:
spritz_wipe_ctx(spritz_ctx ctx):
Wipe spritz context data.
void spritz_wipe_ctx(spritz_ctx *ctx)
# Wipe spritz context data.
========================

spritz_setup(spritz_ctx ctx, key, keyLen)
Setup spritz state (spritz_ctx) with a key.
spritz_setupIV(spritz_ctx ctx, key, keyLen, nonce, nonceLen)
Setup spritz state with a key and nonce (Salt).
spritz_rand_byte(spritz_ctx ctx)
Generates a byte of keystream from spritz state (spritz_ctx).
void spritz_setup(spritz_ctx *ctx,
const uint8_t *key, uint8_t keyLen)
# Setup spritz state (spritz_ctx) with a key.

void spritz_setupIV(spritz_ctx *ctx,
const uint8_t *key, uint8_t keyLen,
const uint8_t *nonce, uint8_t nonceLen)
# Setup spritz state with a key and nonce (Salt).

spritz_hash(digest, digestLen, data, dataLen)
Spritz cryptographic hash function.
spritz_mac(digest, digestLen, msg, msgLen, key, keyLen)
Spritz Message Authentication Code (MAC) function.
uint8_t spritz_rand_byte(spritz_ctx *ctx)
# Generates a byte of keystream from spritz state (spritz_ctx).
========================

void spritz_hash(uint8_t *digest, uint8_t digestLen,
const uint8_t *data, unsigned int dataLen)
# Spritz cryptographic hash function.

spritz_hash_setup(spritz_ctx hash_ctx)
Setup spritz hash state.
spritz_hash_update(spritz_ctx hash_ctx, data, dataLen)
Add data chunk to hash.
spritz_hash_final(spritz_ctx hash_ctx, digest, digestLen)
Output hash digest.
void spritz_mac(uint8_t *digest, uint8_t digestLen,
const uint8_t *msg, unsigned int msgLen,
const uint8_t *key, unsigned int keyLen)
# Spritz Message Authentication Code (MAC) function.
========================

spritz_mac_setup(spritz_ctx mac_ctx, key, keyLen)
Setup spritz MAC state.
spritz_mac_update(spritz_ctx mac_ctx, msg, msgLen)
Add message/data chunk to MAC.
spritz_mac_final(spritz_ctx mac_ctx, digest, digestLen)
Output MAC digest.
void spritz_hash_setup(spritz_ctx *hash_ctx)
# Setup spritz hash state.

void spritz_hash_update(spritz_ctx *hash_ctx,
const uint8_t *data, unsigned int dataLen)
# Add data chunk to hash.

void spritz_hash_final(spritz_ctx *hash_ctx,
uint8_t *digest, uint8_t digestLen)
# Output hash digest.
========================

void spritz_mac_setup(spritz_ctx *mac_ctx,
const uint8_t *key, unsigned int keyLen)
# Setup spritz MAC state.

void spritz_mac_update(spritz_ctx *mac_ctx,
const uint8_t *msg, unsigned int msgLen)
# Add message/data chunk to MAC.

void spritz_mac_final(spritz_ctx *mac_ctx,
uint8_t *digest, uint8_t digestLen)
# Output MAC digest.


Examples
Expand Down Expand Up @@ -84,8 +104,16 @@ Create an issue on GitHub:
<https://github.com/abderraouf-adjal/ArduinoSpritzCipher/issues>


Keywords
========

spritz cipher implementation, spritz implementation, implementation of spritz
spritz stream cipher, spritz encryption, spritz algorithm.


Copyright
=========

Copyright (c) 2015 Abderraouf Adjal

License: The MIT License.
2 changes: 1 addition & 1 deletion SpritzCipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void
spritz_mac_update(spritz_ctx *mac_ctx,
const uint8_t *msg, unsigned int msgLen)
{
absorbBytes(mac_ctx, msg, msgLen); /* spritz_hash_update() */
absorbBytes(mac_ctx, msg, msgLen); /* Like spritz_hash_update() */
}

/* Output MAC digest */
Expand Down

0 comments on commit fcb3860

Please sign in to comment.