GithubHelp home page GithubHelp logo

gmpsepp / practicalcrypto Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gutierrezps/practicalcrypto

0.0 0.0 0.0 20 KB

A simple library to encrypt and decrypt strings with hashing, based on BearSSL

License: GNU Lesser General Public License v2.1

JavaScript 12.55% C++ 69.94% PHP 17.50%

practicalcrypto's Introduction

PracticalCrypto

A simple library to encrypt and decrypt strings with hashing, for ESP8266, based on BearSSL library that is already available on the ESP8266 Arduino core.

Based on "Practical IoT Cryptography On The Espressif ESP8266", by Sean Boyce on Hackaday, published at June 20, 2017.

Implementation details of this library are shown at https://gutierrezps.wordpress.com/2020/05/25/practical-iot-cryptography-on-the-esp8266-using-arduino/.

Features

  • Simple usage, only three main methods can be used
  • String inputs and outputs
  • Encryption key generation

Examples

The examples folder contains library examples for Arduino. The extras folder contains examples for PHP (run with php <example>.php) and NodeJS (run with nodejs <example>.js).

API

  • bool setKey(String key) - Set an encryption key (exactly 64 char long), Returns true if key was set sucessfully set.
  • String getKey() - Returns the key currently set.
  • String generateKey() - Generates a random 64-char long encryption key.
  • String encrypt(String plaintext) - Encrypts the given plaintext with the key set previously. Returns the ciphertext encoded as an hex string.
  • String decrypt(String ciphertext) - Decrypts the given ciphertext hex string with the key set previously. Returns the original plaintext.
  • uint16_t hexStringToArray(String input, uint8_t *output, uint16_t capacity) - Converts an hex string to a byte array.
  • String arrayToHexString(uint8_t *input, uint16_t len) - Converts a byte array to an hex string.
  • PracticalCrypto::Status lastStatus() - If something went wrong while encrypting, decrypting or converting from hex to binary, lastStatus() will indicate what went wrong.

practicalcrypto's People

Contributors

gutierrezps 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.