Check-in [1474c563a5]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add passphrase entropy estimation
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1474c563a5546eba05c1ef10a241de8ef7f9aae8
User & Date: bernd 2019-01-06 20:05:39
Context
2019-01-06
22:04
Add passphrase entropy estimation check-in: 7e6316bb4a user: bernd tags: trunk
20:05
Add passphrase entropy estimation check-in: 1474c563a5 user: bernd tags: trunk
19:39
Add passphrase entropy estimation check-in: cbf210fda5 user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to keys.fs.

536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
    0e 1- 0 max bounds ?DO
	0 I c@ I 1+ c@ 2dup min >r max r> ?DO
	    I cells ph-histogram + @ 0<> - LOOP
	dup * [ 1e $10000 fm/ ] FLiteral fm* f+
    LOOP ;

: g-test ( n -- entropy )
    1e fm/ fln { f: n0 }
    0e  ph-histogram $100 cells bounds DO
	I @ ?dup-IF  s>f fdup fln n0 f- f* f+  THEN
    cell +LOOP ;

: passphrase-entropy ( addr u -- fentropy )
    \G estimate passphrase entropy
    dup 0= IF  2drop 0e  EXIT  THEN  2dup







|







536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
    0e 1- 0 max bounds ?DO
	0 I c@ I 1+ c@ 2dup min >r max r> ?DO
	    I cells ph-histogram + @ 0<> - LOOP
	dup * [ 1e $10000 fm/ ] FLiteral fm* f+
    LOOP ;

: g-test ( n -- entropy )
    [ 1e $100 fm/ ] Fliteral fm* fln { f: n0 }
    0e  ph-histogram $100 cells bounds DO
	I @ ?dup-IF  s>f fdup fln n0 f- f* f+  THEN
    cell +LOOP ;

: passphrase-entropy ( addr u -- fentropy )
    \G estimate passphrase entropy
    dup 0= IF  2drop 0e  EXIT  THEN  2dup