This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
built_in:crypt [2014/12/06 08:33] stevegarman added brief description |
built_in:crypt [2017/07/01 14:27] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
This control provides methods for encryption and decryption. | This control provides methods for encryption and decryption. | ||
===== Methods ===== | ===== Methods ===== | ||
- | ^Method ^Description ^ | + | Some controls use the same methods.\\ |
- | |Crypt.Decrypt( text, | + | For examples of the **[[same methods]]** look here. |
- | |Crypt.Destroy() | | | + | ^ Method |
- | |Crypt.Encrypt( text, | + | | Crypt.Decrypt( text, |
- | |Crypt.GetAbsHeight() | | | + | | Crypt.Encrypt( text, |
- | |Crypt.GetAbsWidth() | | | + | | Crypt.GetType() |
- | |Crypt.GetHeight() | | | + | | Crypt.Hash( text,mode ) |
- | |Crypt.GetPosition() | | | + | | Crypt.Release() |
- | |Crypt.GetType() | | | + | |
- | |Crypt.GetVisibility() | | | + | |
- | |Crypt.GetWidth() | | | + | |
- | |Crypt.Hash( text,mode ) | | | + | |
- | |Crypt.Release() | | | + | |
- | |Crypt.SetBackColor( p1 ) | | | + | |
- | |Crypt.SetBackGradient( p1, | + | |
- | |Crypt.SetBackGradientRadial( p1, | + | |
- | |Crypt.SetBackground( p1,p2 ) | | | + | |
- | |Crypt.SetMargins( left, | + | |
- | |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. | ||
+ | ==== Password check ==== | ||
+ | The following code demonstrates the use of an md5 hash to check a password. | ||
+ | The first time a password is entered, its hash is saved. Every subsequent time, the password' | ||
+ | |||
+ | If it does not match, the app does not continue. | ||
+ | <code JavaScript md5.js> | ||
+ | // | ||
+ | function OnStart() | ||
+ | { | ||
+ | var chk = app.LoadText(" | ||
+ | var pass = prompt(" | ||
+ | if (pass==null) app.Exit(); | ||
+ | var crypt = app.CreateCrypt(); | ||
+ | var md5 = crypt.Hash( pass, | ||
+ | md5 = md5.substr(0, | ||
+ | if (chk == " | ||
+ | else if(chk != md5) | ||
+ | { | ||
+ | app.ShowPopup(" | ||
+ | app.Exit(); | ||
+ | } | ||
+ | |||
+ | // | ||
+ | lay = app.CreateLayout( " | ||
+ | |||
+ | // | ||
+ | txt = app.CreateText( " | ||
+ | txt.SetTextSize( 32 ); | ||
+ | lay.AddChild( txt ); | ||
+ | |||
+ | // | ||
+ | app.AddLayout( lay ); | ||
+ | } | ||
+ | </ |