1 个不稳定版本

0.1.0 2019年3月25日

#5 in #cryptonote


用于cryptonote-crypto

GPL-3.0-or-later

40KB
768 代码行

基于CryptoNote的加密货币的Cryptonight库

codecov

用法

use cryptonight::byte_string;
use cryptonight::hash;
use cryptonight::hash::{MEM_SIZE, ebyte_mul};
use cryptonight::aes;
use cryptonight::aes::{AESSupport};

Cryptonight 白皮书

    let aes = aes::new(AESSupport::HW);

    let input = byte_string::string_to_u8_array("");
    
    let cn_hash = hash::hash_alloc_scratchpad(&input, &aes, hash::HashVersion::Version6);
    // "eb14e8a833fac6fe9a43b57b336789c46ffe93f2868452240720607b14387e11"

    let input2 = b"This is a test";
    let cn_hash2 = hash::hash_alloc_scratchpad(&input2[0..], &aes, hash::HashVersion::Version6);
    // "a084f01d1437a09c6985401b60d43554ae105802c5f5d8a9b3253649c0be6605"

Cryptonight V7

    let aes = aes::new(AESSupport::HW);

    let input = byte_string::string_to_u8_array("0707cff699d605f7eb4dbdcad3a38b462b52e9b8ecdf06fb4c95bc5b058a177f84d327f27db739430000000363862429fb90c0fc35fcb9f760c484c8532ee5f2a7cbea4e769d44cd12a7f201");
    let cn_hash = hash::hash_alloc_scratchpad(&input, &aes, hash::HashVersion::Version7);
    // "a01e369927b90e11d2159a85cedc0fed3f4cc9406b677fbe9c2afb810b20f231"

    let input = byte_string::string_to_u8_array("0707cff699d605f7eb4dbdcad3a38b462b52e9b8ecdf06fb4c95bc5b058a177f84d327f27db739420000000363862429fb90c0fc35fcb9f760c484c8532ee5f2a7cbea4e769d44cd12a7f201");
    let cn_hash = hash::hash_alloc_scratchpad(&input, &aes, hash::HashVersion::Version7);
    // "ecdf8f5c8c0b399709a764257495382fb0230cf6fa55ee02e0667cf3d5be10d6"

依赖项

~0.9–1.2MB
~21K SLoC