All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			
		
			
				
	
	
		
			18 lines
		
	
	
		
			433 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			433 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use sha2::{Digest, Sha256, Sha512};
 | |
| 
 | |
| /// Compute hash of a slice of bytes
 | |
| pub fn sha256(bytes: &[u8]) -> String {
 | |
|     let mut hasher = Sha256::new();
 | |
|     hasher.update(bytes);
 | |
|     let h = hasher.finalize();
 | |
|     format!("{h:x}")
 | |
| }
 | |
| 
 | |
| /// Compute hash of a slice of bytes (sha512)
 | |
| pub fn sha512(bytes: &[u8]) -> String {
 | |
|     let mut hasher = Sha512::new();
 | |
|     hasher.update(bytes);
 | |
|     let h = hasher.finalize();
 | |
|     format!("{h:x}")
 | |
| }
 |