Updated-
Added salt to hash.
Yes, Encoder 3 here we come ; D
Please Don't change the API if possible D:
Sadly, API is changing.
I'll still support Encoder 2 though =).
but only Encoder.create will change, so no worries
Also, I don't know about basing the number of shuffles off of name of player as that wouldn't really strengthen it at all. Each player gets a different key, so by giving them different amounts of shuffles, you end up making collisions if that makes sense =P
Name 1 Name 2 Shuffles
43521 45213 1
53214 25143 2
12435 43521 3
42351 53241 4
53124 41352 5
13245 31542 6
Name 1 Name 2 Shuffles
43521 XXXXX 1
XXXXX 43521 3
1,2,3,5,7,11,13,17,19,23,29,31,37,41
1,1,2,2,4,2,4,2,4,6,2,6,4
library Powers
function isPowerX takes real i, integer j returns boolean
loop
exitwhen i<j
set i=i/j
endloop
return i==1.0
endfunction
endlibrary
Value Scrambled Binary Runs
65536 99655 0 1 Mean = 219091.975
65537 81055 0 1 R = 38.000
65538 398993 1 2 n0 = 52.000
65539 418487 1 2 n1 = 28.000
65540 81902 0 3 n = 80.000
65541 20608 0 3 E( R) = 37.400
65542 367578 1 4 Var(R ) = 16.311
65543 164939 0 5 StDev(R ) = 4.039
65544 56919 0 5 Z = 0.149
65545 288126 1 6 p-value = 0.441
65546 246815 1 6 Randomness 88.19%
65547 67598 0 7
65548 20466 0 7
65549 134593 0 7
65550 341920 1 8
65551 109513 0 9
65552 33806 0 9
65553 286742 1 10
65554 57966 0 11
65555 20076 0 11
65556 338831 1 12
65557 237383 1 12
65558 37565 0 13
65559 86806 0 13
65560 128358 0 13
65561 10556 0 13
65562 18562 0 13
65563 105933 0 13
65564 64761 0 13
65565 99623 0 13
65566 76262 0 13
65567 49511 0 13
65568 150022 0 13
65569 8721 0 13
65570 401983 1 14
65571 579845 1 14
65572 176988 0 15
65573 139061 0 15
65574 83663 0 15
65575 13286 0 15
65576 52993 0 15
65577 781222 1 16
65578 396229 1 16
65579 304509 1 16
65580 35788 0 17
65581 406664 1 18
65582 61193 0 19
65583 55323 0 19
65584 520326 1 20
65585 140189 0 21
65586 111435 0 21
65587 78679 0 21
65588 171954 0 21
65589 32572 0 21
65590 154348 0 21
65591 253470 1 22
65592 117766 0 23
65593 211644 0 23
65594 486599 1 24
65595 90875 0 25
65596 862767 1 26
65597 107701 0 27
65598 80581 0 27
65599 1212346 1 28
65600 55392 0 29
65601 416560 1 30
65602 383168 1 30
65603 261443 1 30
65604 324677 1 30
65605 97915 0 31
65606 129520 0 31
65607 274502 1 32
65608 132315 0 33
65609 158255 0 33
65610 360085 1 34
65611 98331 0 35
65612 722671 1 36
65613 120352 0 37
65614 204130 0 37
65615 955392 1 38
It's as fast as possible ^^
A P-Value of .5 is about as random as it gets ; ).
This took the idea of switching between different primes rather than working up towards the higher primes.
I'm still working it out, but my next idea should be the final algorithm used.
Also, the amount of scrambles used here was 3. I'm going to try for 1 scramble with a P-Value close to .5
Previous algorithms-
P-Value .02
P-Value 0.11867
So you can see, I've been slowly getting better >: )
************************************************************************************
*
* SETTINGS
*
globals
/*************************************************************************************
*
* SALT
*
* Refers to what to append to the player's name when generating scrambler keys
* for each player. This is essentially like a password. It's impossible for another
* map to descramble a number without this password.
*
* This password can be any string, such as "7/ah+53~r\\ZZ"
*
*************************************************************************************/
private constant string SALT = ""
endglobals
/*************************************************************************************
*
* SetShuffleOrder
*
* Creates the shuffling algorithm using 5 different prime bases.
*
* Shuffling mixes a number up using a variety of bases to produce results rivaling
* top random number generators.
*
* Different bases ensure better mixes.
*
* Bases: 2,3,5,7,11
* Shuffle Array: so
*
* Ex:
*
* set so[0]=3 //first mix
* set so[1]=2 //second mix
* set so[2]=7 //third mix
* set so[3]=2 //fourth mix
*
* return 4 //return number of mixes
*
*************************************************************************************/
private keyword so
private function SetShuffleOrder takes nothing returns integer
/*************************************************************************************
*
* MIXES
*
* array: so
* bases: 2,3,5,7,11
*
*************************************************************************************/
set so[0]=5
set so[1]=2
set so[2]=3
set so[3]=11
set so[4]=2
set so[5]=7
set so[6]=3
/*************************************************************************************
*
* MIX COUNT
*
*************************************************************************************/
return 7
endfunction
*
************************************************************************************
I knew that, but what I didn't know was that we're limited to them... =P It's not a problem anywayWell, it does give a list of the bases you can use >.>
This makes reading a number w/o knowing the algorithm used to mix it up totally impossible.
Recall that this algorithm both includes that bases used in every shuffle as well as the hash of the player's name + a string value.
"[email protected]#$%^&*()=+[]<>{}"
":" or ";" or "-"
, but honestly, who cares Base 64= <23456789abcdefgh>+kmn=pqrs^[email protected]#?&%$
Base 63= <23456789abcdefgh>+kmn=pqrs^[email protected]#?&%
2^50= 1125899906842624
Prime= 2736653538294121
64 2^50 64 Prime 63 Prime
5<<<<<<<< aOgBf2xDH c2P%VhA2G
78BWPx4ak 8QvfC6w0= 9SkYRdE=Q
9ZW=HQkA? 87cb<Fe#X 947HQ^wHc
bzv3sagrd DL6T+LaNk KO6GE%hh+
7<ckQ5NvA ghDcDxVC2 >kq#u<FeQ
aXX>gPEf3 hXfmUS^fW k9<5%8%YS
7VfZ^+pp< eb9qPFDMr [email protected]>s%r#[email protected]
cy+exR<Vd dUgsSYYsE fzUFx8&Zh
b9dq=wZm9 [email protected]#=h 8R<EbfxW#
cMWgrSMCa qMfGu<>Uq u<qY%?dGW
6>cbzR$ZK cVCFmTk5Y esW=DDggD
6e5KvR=cc 6A=EM&[email protected] 7>H23Fe>S
[email protected] fSUkNB9E> hRb+#WKgs
9d<d<Rrkr d^=hvCZxU f73CZ3MTw
dZZ#YZGVY dAg#kdLTv feP2xDZ^=
6Q9bC?v43 [email protected] kc=cMXxcn
gMsnqqYHO 6wKaaVf8> 7ez8KNup?
9qdE$qD?7 exY3&8YW+ gkA%#u5x0
9yb>PAnzB cFFg#ewOs ec>v7OzPs
d%sRLp<B2 +p&uf#rcu mV<NF3uEg
9cDXCXaQq gBZdwbb5m >G?^%^z%5
7hm=GHHfa 8UU4POXV+ [email protected]+
h>@FQTn>Z v%98dEk8% z%K^=X5fX
h6&$Ugb&b z6fNH9%rn Dy&SO#m53
9a?f%h5?4 8da^GrN?D 9aQT0>^rb
bHAngfKHd 5KQCAykzL 6+Cqs8hwF
b%&AVyAd? >L%qWZ+AR m4YMpD?6L
9KuBGS#4= 7gSvhG736 86q33fYKL
+FxxpdyUv r4=v7?zqf usepKf7F^
aHxgyVUT+ yDPW<4bY= C?UhP>Z=a
[email protected] 9UzLQ<[email protected] b<m5N<+5Y
>T8hF#svM bVR#[email protected]< d+G6mrC%3
k9S$bT8&g cNwnSbS$G e>TNGAKg6
9g+<phf4U xUyFMrZFH C6VP?SB=N
+qYLsue9h C60^LBKGy [email protected]
5UCc86Z+5 k>y<6y>q$ nWheVMbbm
aQT=RAm6G c%uUZF4BN eCQXspa+>
7sap#gBNf 9QkEp<WD9 [email protected]%0
dGzsYGqZ% >KmKc%S8< m34xnP4v%
dAmXak7S8 d3aVKvsSR eGZpXzAAm
7w3VvCTsF fn7536Vzm hg&A^8KEy
6>[email protected] [email protected] +x6Hspq=x
>Ym$xV$md cSXCBb?3$ epVbyU^Q8
f&SNY66TY 7SGgrg8fh 8M>R=BK7%
bGn7$vrVq 9ERPfXAFy [email protected]@2
c?A2xq90G DsYPF%<uw K^%[email protected]
ad=AFceY4 eG+fTqCR4 gu#yDV^>#
gUgf4FWk+ x2ncBXm7D BcM054mAu
6&65nH=$$ =wN$Vv$fT rxqQM7>vX
99FkycbF8 hkcx+q63X +wPGh76bX
aQT?AD%[email protected] cdc+efzZg [email protected]@
After all, I did come up with the idea of using prime numbers here
No you didn't... the idea I came up with was entirely different from yours >.>. I thought of how base 3 numbers were 1.5 bits, and then I picked prime numbers because that's what I always pick for cryptography : p
I ran the first test with base 3 to base 2 to see how well it worked, then I gathered the statistics.
You contributed nothing, so why should I credit you : P
Base 88: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>[email protected]#$%^&*()-=+_~[]{}?/`;:
1 13 169 453
1 1Y [email protected] 59=
2 28 A) 6:{
3 @ [email protected] 5[u
4 1l lkx b54
5 1~ 15; 6:b
6 + I> 7rG
7 1k II.< 2s0
8 1% )v 2`9
9 ) %> 32e
a ( 10( 2:/
b 1w 1Yh 7t7
c 1c lb/ d[q
d 1F 30q 1pi
e 18 >f 5r*
f ~ 20% 9&N
g 1h 2A6 3]}
o 13 2e[ 3[5
i 1C 10u 3EK
q - 10 2v1
h 1A 1KQ [email protected]
r 14 r9 7ZV
j 1r rN 7X]
p 2h Q% 6cG
k 1n %I 2I1
u 1* 11B 6xr
m 1+ Zc 4RR
s 1G %v 72D
l _ )$ 6t;
w 1d Ne 50a
n 17 IR 4W^
v 1[ 24 3pR
K = A< 3EY
y 1x <; 3Ga
T 1W lic 3Yk
D } 1#n 1^!
x 1v ljn 47W
Q 1M Iwc 3UV
G 2P _X 3+p
Z 1^ >E 3!w
E 1V ljt 3_t
N 1i 4h< 434
J 1? KS 3t!
U 1g 1Nk 2;y
W 1# Ivj 7GG
C 1K ?s 5N:
V 2q w{ d1`
P 1y %o 5sT
t 2u Ox 3x5
Y 1E ){ 5N%
O 2I [email protected] c0%
Haven't updated Encoder to use this yet =).
Tell me if you can crack it w/o looking at the map once Encoder 3 is out ; D.