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/01/13 22:41]
stevegarman added password check sample
built_in:crypt [2017/07/01 06:27]
administrator old revision restored (2015/10/03 17:07)
Line 4: Line 4:
 Some controls use the same methods.\\ Some controls use the same methods.\\
 For examples of the **[[same methods]]** look here. For examples of the **[[same methods]]** look here.
-^Method ^Description ^ +^ Method                          ^ Description  
-|Crypt.Decrypt( text,password ) | +| Crypt.Decrypt( text,password )               
-|Crypt.Destroy() | +| Crypt.Encrypt( text,password )               
-|Crypt.Encrypt( text,password ) | +| Crypt.GetType()                              
-|Crypt.GetAbsHeight() | | +| Crypt.Hash( text,mode )                      
-|Crypt.GetAbsWidth() | | +| Crypt.Release()                              |
-|Crypt.GetHeight() | | +
-|Crypt.GetPosition() | +
-|Crypt.GetType() | +
-|Crypt.GetVisibility() | | +
-|Crypt.GetWidth() | +
-|Crypt.Hash( text,mode ) | | +
-|Crypt.Release() | +
-|Crypt.SetBackColor( p1 ) | | +
-|Crypt.SetBackGradient( p1,p2,p3,p4,p5,p6,p7 ) | | +
-|Crypt.SetBackGradientRadial( p1,p2,p3,p4,p5,p6,p7 ) | | +
-|Crypt.SetBackground( p1,p2 ) | | +
-|Crypt.SetMargins( left,top,right,bottom ) | | +
-|Crypt.SetPadding( p1,p2,p3,p4 ) | | +
-|Crypt.SetPosition( p1,p2,p3,p4 ) | | +
-|Crypt.SetScale( x,y ) | | +
-|Crypt.SetSize( p1,p2 ) | | +
-|Crypt.SetVisibility( p1 ) | |+
 ===== Sample code ===== ===== Sample code =====
 The code samples available from the IDE include a Security Encryption sample which demonstrates the use of this control. The code samples available from the IDE include a Security Encryption sample which demonstrates the use of this control.
Line 37: 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.txt · Last modified: 2017/07/01 14:27 (external edit)