Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function InfiniteHash(code) {
- var pool='';
- var current=0;
- var index=0;
- // returns 0-256
- this.getNext=function() {
- if (pool.length<2) pool=SHA256(code+'|'+(index++).toString());
- var result=parseInt(pool.substr(0,2),16);
- pool=pool.substr(2);
- return result;
- }
- // returns 0-limit, ignoring all that are higher than limit
- this.getNextLimited=function(limit) {
- var k;
- while(true) {
- k=this.getNext();
- if (k<limit) return k;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment