게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
본삭금!]]이러한 스크립트(?)를 실행해주는 프로그램은 어떤게 있을까요?
게시물ID : programmer_7762짧은주소 복사하기
작성자 : Ende
추천 : 0
조회수 : 519회
댓글수 : 4개
등록시간 : 2015/01/21 22:41:18
옵션
  • 베스트금지
  • 본인삭제금지
 
이런 분야는
 
완전 무지해서 질문이 이상해도 양해부탁드립니다 ㅠㅠ
 
 
 
//the seed pair itself
            var clientSeed = "your client seed"; //dont forget to exclude the dash and the nonce!
            var serverSeed = "your server seed";

            //bet made with seed pair (excluding current bet)
            var nonce      = 0;

            //crypto lib for hmac function
            var crypto = require('crypto');

            var roll = function(key, text) {

                //create HMAC using server seed as key and client seed as message
                var hash = crypto.createHmac('sha512', key).update(text).digest('hex');

                var index = 0;

                var lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);

                //keep grabbing characters from the hash while greater than
                while (lucky >= Math.pow(10, 6)) {
                    index++;
                    lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);

                    //if we reach the end of the hash, just default to highest number
                    if (index * 5 + 5 > 128) {
                        lucky = 99.99;
                        break;
                    }
                }

                lucky %= Math.pow(10, 4);
                lucky /= Math.pow(10, 2);

                return lucky;
            }
            console.log(roll(serverSeed, clientSeed+'-'+nonce));
 
 
 
그리고 중간에 Crypto라는 것은 뭐죠??
 
그리고 중간중간 명령어(?)가 아닌, 말로 하는 설명들은 만약 구동한다면 지워줘야 하는건가요?
 
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호