This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
built_in:crypt [2015/09/21 20:42] 96.20.106.102 [Crypt control] |
built_in:crypt [2017/07/01 06:27] administrator old revision restored (2015/10/03 17:07) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | txt = app.CreateText( " | + | ====== Crypt control ====== |
- | txt.SetTextSize( 32 ); | + | This control provides methods for encryption and decryption. |
- | lay.AddChild( txt ); | + | |
===== Methods ===== | ===== Methods ===== | ||
Some controls use the same methods.\\ | Some controls use the same methods.\\ | ||
Line 21: | Line 20: | ||
If it does not match, the app does not continue. | If it does not match, the app does not continue. | ||
<code JavaScript md5.js> | <code JavaScript md5.js> | ||
- | |||
// | // | ||
function OnStart() | function OnStart() | ||
{ | { | ||
- | var crypt = app.CreateCrypt(); | ||
var chk = app.LoadText(" | var chk = app.LoadText(" | ||
- | var pass = prompt(""," | + | var pass = prompt(" |
if (pass==null) app.Exit(); | if (pass==null) app.Exit(); | ||
+ | var crypt = app.CreateCrypt(); | ||
var md5 = crypt.Hash( pass, | var md5 = crypt.Hash( pass, | ||
+ | md5 = md5.substr(0, | ||
if (chk == " | if (chk == " | ||
- | else if(chk != md5) app.Exit(); | + | else if(chk != md5) |
+ | { | ||
+ | app.ShowPopup(" | ||
+ | app.Exit(); | ||
+ | } | ||
+ | |||
// | // | ||
lay = app.CreateLayout( " | lay = app.CreateLayout( " | ||
+ | |||
// | // | ||
- | txt = app.CreateText( " | + | txt = app.CreateText( " |
txt.SetTextSize( 32 ); | txt.SetTextSize( 32 ); | ||
lay.AddChild( txt ); | lay.AddChild( txt ); |