You've already forked nyx
							
							
				mirror of
				https://github.com/rls-moe/nyx
				synced 2025-10-30 12:04:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			321 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			321 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package raw
 | |
| 
 | |
| import (
 | |
| 	"golang.org/x/crypto/pbkdf2"
 | |
| 	"hash"
 | |
| )
 | |
| 
 | |
| const (
 | |
| 	MinRounds = 1
 | |
| 	MaxRounds = 0x7fffffff // setting at 32-bit signed integer limit for now
 | |
| )
 | |
| 
 | |
| func Hash(password, salt []byte, rounds int, hf func() hash.Hash) (hash string) {
 | |
| 	return Base64Encode(pbkdf2.Key(password, salt, rounds, hf().Size(), hf))
 | |
| }
 |