summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-01-15 21:08:59 -0500
committerMalfurious <m@lfurio.us>2022-01-15 21:08:59 -0500
commitf97d1f18030f7afc171db9ba9c0bed597717e64c (patch)
tree065b8724a0ff0a0757732510ef889ae62989589a
parent977317cb3ecf79695f3750f5d88df8ed223b4b22 (diff)
downloadSorensenCompression-master.tar.gz
SorensenCompression-master.zip
Remove remaining Rust codeHEADmaster
Everything has been reimplemented in C. Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r--src/demo_hash.rs23
-rw-r--r--src/main.rs49
2 files changed, 0 insertions, 72 deletions
diff --git a/src/demo_hash.rs b/src/demo_hash.rs
deleted file mode 100644
index 115a10f..0000000
--- a/src/demo_hash.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-use sha2::Digest;
-
-pub fn hash_bigint(n: usize, i: &num::BigInt) -> Vec<u8>
-{
- let (_, bytes) = i.to_bytes_be();
- assert!(bytes.len() <= n);
-
- let mut hash = sha2::Sha512::new();
- hash.input(vec![0; n - bytes.len()]);
- hash.input(bytes);
-
- hash.result().to_vec()
-}
-
-pub fn show_hash(h: &Vec<u8>)
-{
- for x in h
- {
- print!("{:02x}", x);
- }
-
- println!();
-}
diff --git a/src/main.rs b/src/main.rs
deleted file mode 100644
index 5197cbe..0000000
--- a/src/main.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-fn main()
-{
- /* "Compression" setup */
- let raw_file = load_file::load_file_vec(&"data.bin".to_owned()).unwrap();
- let size = raw_file.len();
- let popcnt = vec_pop_cnt(&raw_file);
- let bi_file = BigInt::from_bytes_be(Sign::Plus, &raw_file);
- let solution_hash = demo_hash::hash_bigint(size, &bi_file);
-
- println!("Length: {}", size);
- print!("SHA512: ");
- demo_hash::show_hash(&solution_hash);
- println!("popcnt: {}", popcnt);
-
- /*
- // , ,
- for _ in 0..1000000
- {
- bi = iter::next(&bi);
- }
-
- println!("{:x}", bi);
- panic!("stopping after benchmark");
- */
-
- //panic!("Performing compress only");
-
- /* "Decompression" loop */
- let raw = pop_cnt_vec(popcnt);
- let mut bi = BigInt::from_bytes_be(Sign::Plus, &raw);
-
- loop
- {
- let iteration_hash = demo_hash::hash_bigint(size, &bi);
- //println!("{:b}", bi);
- //println!();
-
- if iteration_hash == solution_hash
- {
- demo_hash::show_hash(&iteration_hash);
- break;
- }
-
- bi = iter::next(&bi);
- }
-
- println!("Found hash (data follows)!!!");
- println!("{:x}", bi);
-}