Download code/bugfind/bench/kernels/ecdh_scalar/post/src/lib.rs from viai957/align: direct link, hf CLI and curl.
- Browser
- Download file 374 Bytes
-
https://huggingface.co/viai957/align/resolve/main/code/bugfind/bench/kernels/ecdh_scalar/post/src/lib.rs
- Command line
-
hf download hf://viai957/align/code/bugfind/bench/kernels/ecdh_scalar/post/src/lib.rs
-
curl -L -o lib.rs https://huggingface.co/viai957/align/resolve/main/code/bugfind/bench/kernels/ecdh_scalar/post/src/lib.rs
374 Bytes
| pub fn validate_x25519_scalar(s: &[u8]) -> bool { | |
| if s.len() != 32 { | |
| return false; | |
| } | |
| let mut all_zero = true; | |
| let mut i = 0usize; | |
| while i < s.len() { | |
| if s[i] != 0 { | |
| all_zero = false; | |
| } | |
| i += 1; | |
| } | |
| if all_zero { | |
| return false; | |
| } | |
| (s[0] & 7) == 0 && (s[31] & 128) == 0 && (s[31] & 64) != 0 | |
| } | |