From ae113f91fefff415898781272b892d670fcb46f4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 14 Jun 2026 17:18:44 +0900 Subject: feat(php-shim): implement random_int/random_bytes with fastrand PHP's random_int/random_bytes are cryptographically secure, but Composer does not rely on that property, so a non-cryptographic PRNG suffices. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe-php-shim/src/lib.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'crates/shirabe-php-shim/src/lib.rs') diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index 2a6ecf6..c236727 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -1,6 +1,8 @@ mod preg; +mod random; pub use preg::*; +pub use random::*; use indexmap::IndexMap; @@ -1360,10 +1362,6 @@ pub fn filesize(_path: &str) -> Option { std::fs::metadata(_path).ok().map(|m| m.len() as i64) } -pub fn random_int(_min: i64, _max: i64) -> i64 { - todo!() -} - pub fn json_encode_ex(_value: &T, _flags: i64) -> Option { todo!() } @@ -1607,10 +1605,6 @@ pub fn bin2hex(_data: &[u8]) -> String { _data.iter().map(|b| format!("{:02x}", b)).collect() } -pub fn random_bytes(_length: usize) -> Vec { - todo!() -} - pub fn is_dir(_path: &str) -> bool { std::path::Path::new(_path).is_dir() } -- cgit v1.3.1