Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===========================================================================
- #**Narzew Hashing Algorithm
- #**Narzew
- #**Version 1.0
- #**24.10.12
- #===========================================================================
- #**Algorithm to hashing int in one way :)
- #===========================================================================
- #**NarzewHash.hash_value(value,key) -> hashs value (level 1) with key
- #**NarzewHash.super_hash(value, key) -> superhashs value (level 2) with key
- #===========================================================================
- #**Use free, but give credit to original author
- #**Modify free, but give credit to original author
- #**Share free, but give credit to original author
- #===========================================================================
- #===========================================================================
- #**Moduł NarzewHash
- #===========================================================================
- module NarzewHash
- #===========================================================================
- #**hash_value(value,key)
- #===========================================================================
- def self.hash_value(x,k=77)
- srand(((300+x*2+k)/2))
- return ((x + rand(x*2) / 2) + 1).to_i
- end
- #===========================================================================
- #**super_hash(value, key)
- #**Require : hash_value
- #===========================================================================
- def self.super_hash(x,k=91)
- return (((NarzewHash.hash_value(NarzewHash.hash_value(NarzewHash.hash_value(NarzewHash.hash_value(NarzewHash.hash_value(NarzewHash.hash_value(NarzewHash.hash_value(x+1,(k-3))+113,(k+3))+294,(k*7))+371,(x-13))+4,(x-7))+152,(k-31))+1,(k*3))+317)/113+1)*7)
- end
- #===========================================================================
- #**End of module
- #===========================================================================
- end
- #===========================================================================
- #**End of script
- #===========================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement