mirror of
https://github.com/arnaucube/kesto.git
synced 2026-02-07 11:36:45 +01:00
Add poseidon-lengths test
This commit is contained in:
2
poseidon-lengths/rs/.gitignore
vendored
Normal file
2
poseidon-lengths/rs/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/target
|
||||
Cargo.lock
|
||||
11
poseidon-lengths/rs/Cargo.toml
Normal file
11
poseidon-lengths/rs/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "rs"
|
||||
version = "0.0.1"
|
||||
authors = ["arnaucube <root@arnaucube.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
poseidon-rs = "0.0.2"
|
||||
rustc-hex = "1.0.0"
|
||||
17
poseidon-lengths/rs/src/lib.rs
Normal file
17
poseidon-lengths/rs/src/lib.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use poseidon_rs::Poseidon;
|
||||
use rustc_hex::ToHex;
|
||||
|
||||
#[test]
|
||||
fn test_output_size() {
|
||||
let poseidon = Poseidon::new();
|
||||
let msg = "45";
|
||||
let h = poseidon.hash_bytes(msg.as_bytes().to_vec()).unwrap();
|
||||
println!("bigint {:?}", h.to_string());
|
||||
println!("length {:?}", h.to_bytes_be().1.len());
|
||||
println!("bytes {:?}", h.to_bytes_be().1);
|
||||
assert_eq!(h.to_bytes_be().1.len(), 31);
|
||||
println!("hex {:?}", h.to_bytes_be().1.to_hex());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user