#![doc = include_str!("../README.md")]
#![allow(clippy::new_without_default)]
use rand::Rng;
#[cfg(feature = "b64")]
use std::str::FromStr;
use crate::utils::SysRngPanic;
#[cfg(feature = "cipher")]
pub mod cipher;
#[cfg(feature = "signature")]
pub mod signature;
#[cfg(feature = "hash")]
pub mod hash;
pub mod token;
pub mod error;
mod utils;
pub fn xor(buf: &mut [u8], key: &[u8]) {
assert_eq!(buf.len(), key.len());
for (a, b) in buf.iter_mut().zip(key) {
*a ^= *b;
}
}
pub fn fill_random(buf: &mut [u8]) {
SysRngPanic.fill_bytes(buf)
}
#[inline(always)]
const fn calculate_b64_len(s: usize) -> usize {
(4 * s).div_ceil(3)
}