EasyCrypto 0.8.1

A simple crypto crate aim at usability
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::fmt::Debug;


pub fn Align<T> (input: T, align: usize) -> T
where T: Copy + std::convert::TryFrom<usize> + std::ops::Add<Output=T> + std::ops::Sub<Output=T> + std::ops::Mul<Output=T> + std::ops::Div<Output=T>, <T as TryFrom<usize>>::Error: Debug
{
	let align: T = align.try_into ().unwrap ();
	((input + align - 1.try_into ().unwrap ())/align)*align
}

pub fn AlignLeft<T> (input: T, align: usize) -> T
where T: Copy + std::convert::TryFrom<usize> + std::ops::Add<Output=T> + std::ops::Mul<Output=T> + std::ops::Div<Output=T>, <T as TryFrom<usize>>::Error: Debug
{
	let align: T = align.try_into ().unwrap ();
	(input/align)*align
}