βΌοΈ Patenting in process. Don't try to steal or you'll lose your money.
This repository was used to conceive and implement rcrypt encryption+hashing algorithm.
rcrypt was made to encrypt/hash information(specifically passwords) with pretty bad performance.
It is also a part of RedLibrary.
It's about 1026.6x - 2328.6x speed down, comparing to Sha256 algorithm.
All functions are in 'rcrypt.h'.
//
// Rcrypt -512 bits-
//
/**
* @brief rcrypt512_enc
*
* @param key Key.
* @param str Information to be locked.
*/
inline void rcrypt512_enc(std::string_view key, std::string *str) {...}
/**
* @brief rcrypt512_dec
*
* @param key Key.
* @param str Information to be unlocked.
*/
inline void rcrypt512_dec(std::string_view key, std::string *str) {...}
/**
* @brief rcrypt512_hash
*
* @param key Key.
* @param str Information to be encrypted and hashed after that.
*
* @return Pointer to a new string with hash.
*/
inline std::string * rcrypt512_hash(std::string_view key, std::string_view str) {...}
//
// Rcrypt -1024 bits-
//
/**
* @brief rcrypt1024_enc
*
* @param key Key.
* @param str Information to be locked.
*/
inline void rcrypt1024_enc(std::string_view key, std::string *str) {...}
/**
* @brief rcrypt1024_dec
*
* @param key Key.
* @param str Information to be unlocked.
*/
inline void rcrypt1024_dec(std::string_view key, std::string *str) {...}
/**
* @brief rcrypt1024_hash
*
* @param key Key.
* @param str Information to be encrypted and hashed after that.
*
* @return Pointer to a new string with hash.
*/
inline std::string * rcrypt1024_hash(std::string_view key, std::string_view str) {...}
//
// Rcrypt -1536 bits-
//
/**
* @brief rcrypt1536_enc
*
* @param key Key.
* @param str Information to be locked.
*/
inline void rcrypt1536_enc(std::string_view key, std::string *str) {...}
/**
* @brief rcrypt1536_dec
*
* @param key Key.
* @param str Information to be unlocked.
*/
inline void rcrypt1536_dec(std::string_view key, std::string *str) {...}
/**
* @brief rcrypt1536_hash
*
* @param key Key.
* @param str Information to be encrypted and hashed after that.
*
* @return Pointer to a new string with hash.
*/
inline std::string * rcrypt1536_hash(std::string_view key, std::string_view str) {...}
Tech notes:
- Padding is provided only for "in" params. Key length(in bytes) is calculated using the formula:
KEY_LENGTH / 8
. - This library is designed for small code size and simplicity, intended for cases where small binary size, low memory footprint and portability is more important than high performance.
Notes:
- If you want to route result of encryption to
std::cout
, you should convert string to hexadecimal system, in other way you will get bad output! - There is no built-in error checking or protection from out-of-bounds memory access errors as a result of malicious input.
Here's an example of encryption in rcrypt512 mode:
And the following one is the decryption of previous message:
All material in this repository is in the public domain.
With CopyrightΒ© β Vladimir Rogozin.