Scopo
Effettua la cifratura del testo passato come argomento con la chiave fornita.
Sintassi
string Encrypted = "" // Valore cifrato
//
Encrypted := SimpleCrypter.Encrypt(chiave, testo)
//
Encrypted := SimpleCrypter.Encrypt(chiave, testo)
Argomenti
Chiave | E' una stringa contenente la chiave da utilizzare per la cifratura del testo. |
Testo | E' una stringa contenente il testo da cifrare. |
Valore di ritorno
Viene ritornata una stringa contenente il testo passato a parametro cifrato mediante la chiave fornita.
Esempio di codice
// ****************************
// Esegue la cifratura dei dati
// ****************************
public void Crypter.Encripta()
{
// Se c'è una chiave di per eseguire la cifratura o la lettura
if NullValue(Crypter.CryptKey, Empty String) <> Empty String
{
SimpleCrypter crypt = new() //
//
// Se c'è un valore da criptare lo cripto
if NullValue(Crypter.Decrypted, Empty String) <> Empty String
{
Crypter.Encrypted := crypt.Encrypt(Crypter.CryptKey, Crypter.
Decrypted)
Crypter.Decrypted := Empty String
}
else //
...
}
else //
...
}
// Esegue la cifratura dei dati
// ****************************
public void Crypter.Encripta()
{
// Se c'è una chiave di per eseguire la cifratura o la lettura
if NullValue(Crypter.CryptKey, Empty String) <> Empty String
{
SimpleCrypter crypt = new() //
//
// Se c'è un valore da criptare lo cripto
if NullValue(Crypter.Decrypted, Empty String) <> Empty String
{
Crypter.Encrypted := crypt.Encrypt(Crypter.CryptKey, Crypter.
Decrypted)
Crypter.Decrypted := Empty String
}
else //
...
}
else //
...
}
- Un buon metodo per criptare una password consiste nel usarla come chiave mentre si cripta un testo noto. In questo modo l'algortimo non è invertibile e non è possibile risalire al valore originario.
- L'implementazione di questa funzione utilizza algoritmi differenti in Java e C#; se si vuole cifrare in modalità compatibile tra i due linguaggi è necessario impostare a True la proprietà CompatibilityMode.
Ultima modifica: 23/03/2021 / Validità: da 6.5.2680