revert beacon.rs to version a42ef24fc5
This commit is contained in:
parent
6d18e24e00
commit
08cb7b6ebb
|
@ -7,8 +7,6 @@ extern crate byteorder;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate hex_literal;
|
extern crate hex_literal;
|
||||||
|
|
||||||
extern crate crypto;
|
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufWriter, BufReader};
|
use std::io::{BufWriter, BufReader};
|
||||||
use blake2_rfc::blake2b::Blake2b;
|
use blake2_rfc::blake2b::Blake2b;
|
||||||
|
@ -34,34 +32,9 @@ fn main() {
|
||||||
use byteorder::{ReadBytesExt, BigEndian};
|
use byteorder::{ReadBytesExt, BigEndian};
|
||||||
use rand::{SeedableRng};
|
use rand::{SeedableRng};
|
||||||
use rand::chacha::ChaChaRng;
|
use rand::chacha::ChaChaRng;
|
||||||
use crypto::sha2::Sha256;
|
|
||||||
use crypto::digest::Digest;
|
|
||||||
|
|
||||||
// Place block hash here (block number #631600)
|
// Place beacon value here (2^42 SHA256 hash of Bitcoin block hash #534861)
|
||||||
// choose block number BTC #631600 at 2020-05-21 15:00:00 UTC+8
|
let beacon_value: [u8; 32] = hex!("2bf41a959668e5b9b688e58d613b3dcc99ee159a880cf764ec67e6488d8b8af3");
|
||||||
// block #631600 generates at ?
|
|
||||||
// generate beacon successfully at ?
|
|
||||||
let mut beacon_value: [u8; 32] = hex!("00000000000000000008de28ff08672c5b85add6d51024b90fa9424dadc82691");
|
|
||||||
|
|
||||||
// Performs 2^n hash iterations over it
|
|
||||||
const N: usize = 32;
|
|
||||||
|
|
||||||
for i in 0..(1u64<<N) {
|
|
||||||
// Print 1024 of the interstitial states
|
|
||||||
// so that verification can be
|
|
||||||
// parallelized
|
|
||||||
if i % (1u64<<(N-10)) == 0 {
|
|
||||||
print!("{}: ", i);
|
|
||||||
for b in beacon_value.iter() {
|
|
||||||
print!("{:02x}", b);
|
|
||||||
}
|
|
||||||
println!("");
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut h = Sha256::new();
|
|
||||||
h.input(&beacon_value);
|
|
||||||
h.result(&mut beacon_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
print!("Final result of beacon: ");
|
print!("Final result of beacon: ");
|
||||||
for b in beacon_value.iter() {
|
for b in beacon_value.iter() {
|
||||||
|
|
Loading…
Reference in New Issue