push 32
const CryptoJS = require("crypto-js"); function seedGenerator(hash, salt) { const hmac = CryptoJS.HmacSHA256(CryptoJS.enc.Hex.parse(hash), salt); return hmac.toString(CryptoJS.enc.Hex); } function createNums(allNums, hash) { const nums = []; let h = CryptoJS.SHA256(hash).toString(CryptoJS.enc.Hex); allNums.forEach((c) => { nums.push({ num: c, 해시: h }); h = h.substring(1) + h.charAt(0); }); nums.sort(function (o1, o2) { if (o1.hash < o2.hash) { return -1; } else if (o1.hash === o2.hash) { return 0; } else { return 1; } }); 반환 숫자; } function keno(hash) { const salt = '생성되기를 기다리는 소금'; const allNums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40] const seed = seedGenerator(해시, 소금) ; let finalNums = createNums(allNums, seed); finalNums = createNums(finalNums, seed); return finalNums.slice(0, 10).map(m => m.num) } let hash = '게임 해시'; console.log('result =>', keno( hash ).map(item => item.num).join(','));