DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


built_in:crypt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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] (current)
administrator old revision restored (2015/10/03 17:07)
Line 1: Line 1:
-txt app.CreateText( "​Hello"​ );​ +====== 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>
- 
 //​Called when application is started. //​Called when application is started.
 function OnStart() function OnStart()
 { {
-    var crypt = app.CreateCrypt();​ 
     var chk = app.LoadText("​hash","​unset"​);​     var chk = app.LoadText("​hash","​unset"​);​
-    var pass = prompt("","​Please enter password");+    var pass = prompt("​Please enter password",""​);​
     if (pass==null) app.Exit();​     if (pass==null) app.Exit();​
 +    var crypt = app.CreateCrypt();​
     var md5 = crypt.Hash( pass,​ "​MD5"​ );​     var md5 = crypt.Hash( pass,​ "​MD5"​ );​
 +    md5 = md5.substr(0,​22);​
     if (chk == "​unset"​) app.SaveText("​hash",​ md5)     if (chk == "​unset"​) app.SaveText("​hash",​ md5)
-    else if(chk != md5) app.Exit();​ +    else if(chk != md5) 
 +    { 
 +        app.ShowPopup("​Incorrect password"​);​ 
 +        app.Exit(); 
 +    } 
 + 
     //​Create a layout with objects vertically centered.     //​Create a layout with objects vertically centered.
     lay = app.CreateLayout( "​linear",​ "​VCenter,​FillXY"​ );​         lay = app.CreateLayout( "​linear",​ "​VCenter,​FillXY"​ );​    
 + 
     //​Create a text label and add it to layout.     //​Create a text label and add it to layout.
-    txt = app.CreateText( "​Hello" );+    txt = app.CreateText( "​Welcome" );
     txt.SetTextSize( 32 );​     txt.SetTextSize( 32 );​
     lay.AddChild( txt );​     lay.AddChild( txt );​
built_in/crypt.1442868167.txt.gz · Last modified: 2015/09/21 20:42 (external edit)