This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![allow(deprecated)] | |
| use chrono::{DateTime, Duration, /*Local, */Timelike, Utc}; | |
| use num_bigint::BigUint; | |
| use rand_0_8_5::{thread_rng as rng_legacy, Rng as RngLegacy}; | |
| use rand_0_9_2::{thread_rng as rng_latest, Rng as RngLatest}; | |
| use sha2::{Digest, Sha256}; | |
| // --- GIT-COMPLIANT SHA-1 ENGINE --- | |
| fn git_sha1(data: &[u8]) -> String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! # Cryptographic Playground V2 - Seeded Edition | |
| //! Demonstrates using recursive macros to generate entropy seeds for | |
| //! deterministic RNG initialization while handling complex token trees. | |
| #![allow(deprecated)] | |
| #![allow(unused_attributes)] | |
| #![allow(dead_code)] | |
| use rand_0_8_5::{SeedableRng as SeedableLegacy, Rng as RngLegacy}; | |
| use rand_0_9_2::{SeedableRng as SeedableLatest, Rng as RngLatest}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use chrono::{DateTime, Duration, Utc, Timelike}; | |
| use sha2::{Sha256, Digest}; | |
| // --- GIT-COMPLIANT SHA-1 ENGINE --- | |
| fn git_sha1(data: &[u8]) -> String { | |
| let mut h0: u32 = 0x67452301; let mut h1: u32 = 0xEFCDAB89; | |
| let mut h2: u32 = 0x98BADCFE; let mut h3: u32 = 0x10325476; | |
| let mut h4: u32 = 0xC3D2E1F0; | |
| let mut padded = data.to_vec(); | |
| let bit_len = (padded.len() as u64) * 8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![allow(unexpected_cfgs)] | |
| #![allow(deprecated)] | |
| // --- SECTION 1: NIGHTLY (no_std + Allocator) --- | |
| #[cfg(nightly)] | |
| mod nightly_impl { | |
| #![feature(alloc_error_handler)] | |
| #![no_std] | |
| #![no_main] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::fs::OpenOptions; | |
| use std::os::unix::io::AsRawFd; | |
| use std::time::Instant; | |
| use sha2::{Sha256, Digest}; | |
| use libc::{ioctl, c_int}; | |
| // Linux ioctl structure for entropy injection | |
| #[repr(C)] | |
| struct RandPoolInfo { | |
| entropy_count: c_int, // Bits of entropy (not bytes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![allow(deprecated)] | |
| use serde::{Serialize, Deserialize}; | |
| use serde_json; | |
| use sha2::{Sha256, Digest}; | |
| use rand_0_8_5::{thread_rng as rng_legacy, Rng as RngLegacy}; | |
| use rand_0_9_2::{thread_rng as rng_latest, Rng as RngLatest}; | |
| use chrono::Local; | |
| #[derive(Serialize, Deserialize, Debug)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use chrono::{DateTime, Duration, Utc}; | |
| #[derive(Debug, Clone, Copy)] | |
| pub struct Estimation { | |
| pub d: f64, // Difference in seconds | |
| pub a: f64, // Uncertainty | |
| } | |
| pub fn estimate_offset(s: DateTime<Utc>, r: DateTime<Utc>, c: DateTime<Utc>) -> Estimation { | |
| // d = c - (r + s) / 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::time::Instant; | |
| #[derive(Debug, Clone, Copy)] | |
| pub struct Estimation { | |
| pub d: f64, | |
| pub a: f64, | |
| } | |
| pub fn estimate_offset(s: f64, r: f64, c: f64) -> Estimation { | |
| Estimation { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use nalgebra::{DMatrix, DVector}; | |
| // Import the Rng trait so that .gen() is available on thread_rng() | |
| use rand_0_8_5::Rng; | |
| /// 1. Computes standard Softmax Attention Y | |
| fn compute_softmax_attention(q: &DMatrix<f64>, k: &DMatrix<f64>, v: &DMatrix<f64>) -> DMatrix<f64> { | |
| let mut scores = q * k.transpose(); | |
| for i in 0..scores.nrows() { | |
| let mut row = scores.row_mut(i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn main() { | |
| let mut nonces = vec![0u128]; | |
| let mut counter = 0u64; | |
| nonces.pop(); | |
| // First Gap: 1.5 x 10^9 to 2.0 x 10^9 | |
| //counter += (2.0e9 - 1.5e9) as u64; | |
| for nonce in 1_500/*_000_000*/..=3_000/*_000_000*/ { | |
| nonces.push(nonce*1_000_000); | |
| counter = counter+1; |
NewerOlder