forked from GalacticAlien/TheGalacticLottery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TheGalacticLotteryScript.js
333 lines (307 loc) · 12.1 KB
/
TheGalacticLotteryScript.js
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
/*FOR ALL THE GALACTIC FRIENDS OUT.. FUCK THE GALACTIC FEDERATION!!!!/*
********************************************************************************
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO$$777IIII777$$ZZZ8MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMO$7?==?I7$77$7777777777$ZZONMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMNZ7?~=7$$$$$$$$$$777777777$$77$$ZONMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMO$?:=7$$$$$$$$$$$$$7777777777777$$$$ZO8MMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMO$~,7$$$$$$$$$$$$$$$$$777777777777777$$$ZO8MMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMM$+,$$$$$$$$$$$$$$$$$$$$$77777777777777777$$Z8MMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMM$:?$$$$$$$$$$$$$$$$$$$$$$$777777777777777777$ZODMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMD7,I$$$$$$$$$$$$$$$$$$$$$$$$$777777777777777777$Z8NMMMMMMMMMMMMMMM
MMMMMMMMMMMMMM7,$$$$$$$$$$$$$$$$$$$$$$$$$$$$777777777777777777$Z8NMMMMMMMMMMMMMM
MMMMMMMMMMMMM$:7$$$$$$$$$$$$$$$$$$$$$$$$$$$$7777777777777777777$ODMMMMMMMMMMMMMM
MMMMMMMMMMMMZ+?$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$777777777777777777$ZONMMMMMMMMMMMMM
MMMMMMMMMMMM$~$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77777777777777777$$ZDMMMMMMMMMMMMM
MMMMMMMMMMMZ+I$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77777777777777777$Z8NMMMMMMMMMMMM
MMMMMMMMMMM$=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$77777777777777777$ONMMMMMMMMMMMM
MMMMMMMMMMD$?$ZZZ$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7$777777777777777$ODMMMMMMMMMMMM
MMMMMMMMMMO77ZZZOOOOZZ$$$$$$$$$$$$$$$$$$$$$$$$$$$7777777$$$$$$777$ZDMMMMMMMM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MMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMM8O$$$$$$$7777777II$$$$$Z8NNMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMM8OZ$$$$$$$$$$$$$$$$$$Z8NMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMM8OZZ$$$$$$$$$$$$$$$ZDNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM8OZ$$$$$$$$$$$$Z8NNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM88OZ$$$$$$$$ZODNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMD8OOZZZZO8DNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNDDDDNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
********************************************************************************
/* PRINT TO DIV FUNCTIONS*/
function print(str){
$('#myLog').append('<div ></div>');
$('#myLog div:last').text(str) ;
var objDiv = document.getElementById("myLog");
objDiv.scrollTop = objDiv.scrollHeight;
linecount = linecount+1;
if(linecount>100){
$("#myLog div").first().remove();
}
return (linecount);
}
function printN(str){
$('#keyCountS').text(str) ;
}
/* TIMER*/
var daysLabel = document.getElementById("days");
var hoursLabel = document.getElementById("hours");
var minutesLabel = document.getElementById("minutes");
var secondsLabel = document.getElementById("seconds");
var totalSeconds = 0;
setInterval(setTime, 1000);
function setTime() {
++totalSeconds;
secondsLabel.innerHTML = pad(totalSeconds % 60);
var minu = Math.floor(totalSeconds/60);
minutesLabel.innerHTML = pad(minu % 60);
var hou = Math.floor(totalSeconds/60/60);
hoursLabel.innerHTML = pad(hou % 24);
daysLabel.innerHTML = pad(parseInt(totalSeconds/ 86400));
}
function pad(val) {
var valString = val + "";
if (valString.length < 2) {
return "0" + valString;
}
else {
return valString;
}
}
/*ELLIPTIC CURVE SECP256K*/
Pcurve = bigInt("115792089237316195423570985008687907853269984665640564039457584007908834671663");
N= bigInt("115792089237316195423570985008687907852837564279074904382605163141518161494337");
Acurve = bigInt("0"); Bcurve = bigInt("7");
Gx = bigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240");
Gy = bigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424");
var GPoint = [Gx,Gy];
var stop = 0;
function modinv(a,n){
lm = 1;
hm = 0;
low1 = bigInt(a).mod(bigInt(n));
low2 = bigInt(low1).add(bigInt(n));
low = bigInt(low2).mod(bigInt(n));
high = bigInt(n);
while (bigInt(low).compare(bigInt(1)) == 1){
ratio = bigInt(high).divide(bigInt(low));
nm1 = bigInt(lm).multiply(bigInt(ratio));
nm = bigInt(hm).subtract(bigInt(nm1));
new2 = bigInt(low).multiply(bigInt(ratio));
new1 = bigInt(high).subtract(new2);
high = bigInt(low);
hm = bigInt(lm);
lm = bigInt(nm);
low = bigInt(new1);
}
re1 = bigInt(lm).mod(bigInt(n));
re2 = bigInt(re1).add(bigInt(n));
re = bigInt(re2).mod(bigInt(n));
return (re);
}
function ECadd(a,b){
b0 = bigInt(b[0]);
b1 = bigInt(b[1]);
a0 = bigInt(a[0]);
a1 = bigInt(a[1]);
LamAdd1 = bigInt(b1).subtract(bigInt(a1));
LamAdd2 = bigInt(b0).subtract(bigInt(a0));
LamAdd3 = modinv(bigInt(LamAdd2),bigInt(Pcurve));
LamAdd4 = bigInt(LamAdd1).multiply(bigInt(LamAdd3));
LamAdd5 = bigInt(LamAdd4).mod(bigInt(Pcurve));
LamAdd6 = bigInt(LamAdd5).add(bigInt(Pcurve));
LamAdd = bigInt(LamAdd6).mod(bigInt(Pcurve));
x1 = bigInt(LamAdd).multiply(bigInt(LamAdd));
x2 = bigInt(x1).subtract(bigInt(a0));
x3 = bigInt(x2).subtract(bigInt(b0));
x4 = bigInt(x3).mod(bigInt(Pcurve));
x5 = bigInt(x4).add(bigInt(Pcurve));
x = bigInt(x5).mod(bigInt(Pcurve));
y1 = bigInt(a0).subtract(bigInt(x));
y2 = bigInt(LamAdd).multiply(bigInt(y1));
y3 = bigInt(y2).subtract(bigInt(a1));
y4 = bigInt(y3).mod(bigInt(Pcurve));
y5 = bigInt(y4).add(bigInt(Pcurve));
y = bigInt(y5).mod(bigInt(Pcurve));
return [x,y];
}
function ECdouble(a){
a0 = bigInt(a[0]);
a1 = bigInt(a[1]);
lamA1 = bigInt(3).multiply(a0);
lamA2 = bigInt(lamA1).multiply(bigInt(a0));
lamA3 = bigInt(lamA2).add(bigInt(Acurve));
lamB1 = bigInt(2).multiply(bigInt(a1));
lamB2 = modinv(bigInt(lamB1),bigInt(Pcurve));
lamB3 = bigInt(lamB2).multiply(bigInt(lamA3));
Lam1 = bigInt(lamB3).mod(bigInt(Pcurve));
Lam2 = bigInt(Lam1).add(bigInt(Pcurve));
Lam = bigInt(Lam2).mod(bigInt(Pcurve));
x1 = bigInt(Lam).multiply(bigInt(Lam));
x2 = bigInt(2).multiply(bigInt(a[0]));
x3 = bigInt(x1).subtract(bigInt(x2));
x4 = bigInt(x3).mod(bigInt(Pcurve));
x5 = bigInt(x4).add(bigInt(Pcurve));
x = bigInt(x5).mod(bigInt(Pcurve));
y1 = bigInt(a[0]).subtract(bigInt(x));
y2 = bigInt(Lam).multiply(bigInt(y1));
y3 = bigInt(y2).subtract(bigInt(a[1]));
y4 = bigInt(y3).mod(bigInt(Pcurve));
y5 = bigInt(y4).add(bigInt(Pcurve));
y = bigInt(y5).mod(bigInt(Pcurve));
return [x,y];
};
function EccMultiply(GenPoint,Scalar){
ScalarSub = bigInt(N).subtract(Scalar);
if (bigInt(N).compare(Scalar) == -1 || bigInt(Scalar).compare(0) == 0){
print("Invalid Private Key");
}
else{
ScalarBin = bigInt(Scalar).toString(2);
var Q=GenPoint;
var i = 1;
while (i < ScalarBin.length){
Q=ECdouble(bigInt(Q));
if (ScalarBin[i] == "1"){
Q=ECadd(bigInt(Q),bigInt(GenPoint));
}
var i = i+1;
}
return (Q);
}
}
/*pseudo-random function*/
function randomval(){
array = new Uint8Array(totalBytesf);
var crypto = window.crypto || window.msCrypto;
randomNum = crypto.getRandomValues(array);
var wloop = 1;
var sumBytes = randomNum[0].toString(16);
while (bigInt(totalBytesf).subtract(wloop)>0){
sumBytes = sumBytes.concat(randomNum[wloop].toString(16));
wloop = bigInt(wloop).add(1);
}
window.sumBytesf=sumBytes;
}
/*PRIVATE KEY DEC2WIF*/
function privDec2Wif(dec){
privBin= dec.toString(2);
prifix = "10000000";
prepend0a= 256-privBin.length;
prepend0b= prifix.concat(Array(prepend0a + 1).join("0"),privBin);
bin2Hex= bigInt(prepend0b, 2).toString(16);
binDecode= hex2a(bin2Hex);
sha256x1 = SHA256(binDecode);
binDecodesha= hex2a(sha256x1);
sha256x2 = SHA256(binDecodesha);
checksum = sha256x2.substr(0, 8);
prewif= bin2Hex.concat(checksum);
privWif = enc64_58(prewif);
return (privWif);
}
/*START FUNCTION*/
function start1(){
blockSize = bigInt("100");
blocklimit = bigInt(N).divide(blockSize);
blocklimitHex = blocklimit.toString(16);
totalBytes = blocklimit.toString(16).length;
if (totalBytes % 2 == 0){
totalBytesf= (totalBytes)/2;
firstByte = blocklimitHex.charAt(0)+blocklimitHex.charAt(1);
firstByte1 = parseInt(firstByte, 16);
priHex = (Math.floor(Math.random() * firstByte1) + 0).toString(16);
}
else{
totalBytesf =(totalBytes-1)/2;
firstByte = blocklimitHex.charAt(0);
firstByte1 = parseInt(firstByte, 16);
priHex = (Math.floor(Math.random() * firstByte1) + 0).toString(16);
}
randomval(totalBytesf);
userInputHex = priHex.concat(sumBytesf);
userInput = bigInt(userInputHex,16);
if (bigInt(userInput).subtract(blocklimit)>0){
start1();
}
else {
blockNumber = userInput;
}
}
/*MAIN FUNCTION*/
function hashing(){
start1()
var loopCount = blockSize;
startRangeMul = bigInt(blockNumber).multiply(blockSize);
startRange = bigInt(startRangeMul).add("1");
endRange =bigInt(startRange).add(blockSize);
var key = startRange;
var y =0;
print("******************************************************************");
var sVar = setInterval(function(){
if (loopCount<1 && y<1) {
clearInterval(sVar);
hashing();
}
PublicKey = EccMultiply(bigInt(GPoint),bigInt(key));
uncompress = "04" + bigInt(PublicKey[0]).toString(16) + PublicKey[1].toString(16);
uncompressbin = hex2a(uncompress);
outputsha256 = SHA256(uncompressbin);
outbin = hex2a(outputsha256);
outputripemd160 = RMDstring(outbin);
if (satoshiKeys.indexOf(outputripemd160) != -1){
lr = bigInt(key);
lt = "It's a Match!!!!!!";
text= "Private Key Decimal: ";
text1= "Private Key WIF: ";
y = y+1;
print("*********************************************************");
print(lt);
print(text.concat(lr));
print(text1.concat(privDec2Wif(bigInt(key))));
clearInterval(sVar);
}
else{
lr = bigInt(key);
lt = "No Match!";
n= n+1;
text= "Private Key Decimal: ";
text1= "Public Key Hex: ";
print(text.concat(lr));
print(text1.concat(outputripemd160));
print(lt);
print(".");
printN(n);
}
key = bigInt(key).add("1");
loopCount = bigInt(loopCount).subtract("1");
return [key,loopCount,y,n];
},0);
};
/*TRIGGER*/
var linecount = 0;
var n =0;
hashing();