Giter VIP home page Giter VIP logo

lua-salsa20's Introduction

lua-salsa20

Build Status

Salsa20 eStream cipher in Lua.

The Salsa20 stream cipher was published by Daniel J. Bernstein of the University of Illinois at Chicago in 2005 and submitted to the eSTREAM project.

The algorithm is an efficient and well-designed cipher. As of 2015, there are no effective attacks on this cipher.

Resources

Usage

All byte sequences are implemented as strings, which are 8-bit clean in Lua.

generate

salsa20.generate(k, v, i, rounds)

Arguments

k
A 16-byte or 32-byte sequence representing the secret key.
v
An 8-byte sequence representing the nonce.
i
An 8-byte sequence representing the stream position of the 64-byte block.
rounds (optional)
May be 20 (default), 12, or 8.

Return Value

A 64-byte output block.

encrypt

salsa20.encrypt(key, nonce, plaintext, rounds)

Arguments

key
A 16-byte or 32-byte sequence representing the secret key.
nonce
An 8-byte sequence representing the nonce.
plaintext
The unencrypted message.
rounds (optional)
May be 20 (default), 12, or 8.

Return Value

The encrypted message.

encrypt_table

salsa20.encrypt_table(key, nonce, plaintab, rounds)

This is a convenience function for encrypting multiple strings while maintaining state.

Arguments

key
A 16-byte or 32-byte sequence representing the secret key.
nonce
An 8-byte sequence representing the nonce.
plaintab
A table containing unencrypted messages.
rounds (optional)
May be 20 (default), 12, or 8.

Return Value

A table containing encrypted messages.

decrypt

salsa20.decrypt(key, nonce, ciphertext, rounds)

Arguments

key
A 16-byte or 32-byte sequence representing the secret key.
nonce
An 8-byte sequence representing the nonce.
ciphertext
The encrypted message.
rounds (optional)
May be 20 (default), 12, or 8.

Return Value

The unencrypted message.

decrypt_table

salsa20.decrypt_table(key, nonce, ciphertab, rounds)

This is a convenience function for decrypting multiple strings while maintaining state.

Arguments

key
A 16-byte or 32-byte sequence representing the secret key.
nonce
An 8-byte sequence representing the nonce.
ciphertab
A table containing encrypted messages.
rounds (optional)
May be 20 (default), 12, or 8.

Return Value

A table containing unencrypted messages.

lua-salsa20's People

Contributors

mrogaski avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tst2005

lua-salsa20's Issues

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.