Skip to content

Instantly share code, notes, and snippets.

@ioleksiy
Created March 2, 2012 18:14
Show Gist options
  • Save ioleksiy/1960145 to your computer and use it in GitHub Desktop.
Save ioleksiy/1960145 to your computer and use it in GitHub Desktop.
PhoneGap Application Encryption
- (void) fetchKey:(char[]) key
{
//ffffffffffffffffffffffffffffffff
key[0] = 0x66;
key[1] = 0x66;
key[2] = 0x66;
key[3] = 0x66;
key[4] = 0x66;
key[5] = 0x66;
key[6] = 0x66;
key[7] = 0x66;
key[8] = 0x66;
key[9] = 0x66;
key[10] = 0x66;
key[11] = 0x66;
key[12] = 0x66;
key[13] = 0x66;
key[14] = 0x66;
key[15] = 0x66;
key[16] = 0x66;
key[17] = 0x66;
key[18] = 0x66;
key[19] = 0x66;
key[20] = 0x66;
key[21] = 0x66;
key[22] = 0x66;
key[23] = 0x66;
key[24] = 0x66;
key[25] = 0x66;
key[26] = 0x66;
key[27] = 0x66;
key[28] = 0x66;
key[29] = 0x66;
key[30] = 0x66;
key[31] = 0x66;
}
<?
function icrypt($plaintext, $key) {
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_ECB);
}
//usage:
$newHtml = icrypt('<html></html>', 'ffffffffffffffffffffffffffffffff');
@ioleksiy
Copy link
Author

ioleksiy commented Mar 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment