| gumd API Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <gum/common/gum-crypt.h> gint gum_crypt_cmp_secret (const gchar *plain_str1,const gchar *enc_str2); gchar * gum_crypt_encrypt_secret (const gchar *secret,const gchar *encryp_algo);
Following code snippets shows how a string can be encrypted with any of the supported encryption algorithm. Moreover, plain and encrypted secrets can be compared if needed.
gchar *pass = gum_crypt_encrypt_secret("pas.-s123", "SHA512");
g_free (pass);
pass = gum_crypt_encrypt_secret("pass ?()123", "SHA512");
gum_crypt_cmp_secret("pass ?()123", pass); //should return true.
g_free (pass);
gint gum_crypt_cmp_secret (const gchar *plain_str1,const gchar *enc_str2);
Encrypts plain string with the same parameters as that of encrypted string and then compares both encrypted strings.
|
plain string. [transfer none] |
|
encrypted string. [transfer none] |
Returns : |
0 if enc_str1 == enc_str2, less than 0 if the enc_str1 < enc_str2, greater than 0 if enc_str1 > enc_str2. |
gchar * gum_crypt_encrypt_secret (const gchar *secret,const gchar *encryp_algo);
Encrypts the secret with the specified algorithm encryp_algo.
|
string to encrypt. [transfer none] |
|
algorithm to be used for encryption. 'MD5', 'SHA256', 'SHA512', and 'DES' are supported algorithms. |
Returns : |
encrypted secret if successful, NULL otherwise. [transfer full] |