Which encryption algorithm is 100% secure? OTP!
OTP (one-time-pad, one password at a time) is the only password proved to be undeciphable in mathematics. OTP is generally only used in situations where secrets are extremely important: military and diplomatic affairs. However, because the key length is very long and it is very difficult to store and exchange keys securely, OTP is not applicable to many occasions. Therefore, in practice, OTP is not used for encryption, but symmetric encryption is used.
The following is an example of OTP encryption: Public static string generatesalt (INT size) // create a salt value
{
// Create a strong random number
Rngcryptoserviceprovider crypto = new rngcryptoserviceprovider ();
Byte [] buff = new byte [size];
Crypto. getbytes (buff );
Return convert. tobase64string (buff );
}
Public static string generatepwdhash (string PWD, string salt) // Encrypt
{
String saltpwd = string. Concat (PWD, salt); // combine the plain text with the salt value
String Password = formsauthentication. hashpasswordforstoringinconfigfile (saltpwd, "sha1 ");
Return password;
}
The rngcryptoserviceprovider class inherits from cryptoserviceprovider (CSP) and is used to generate a strong random number. It has the same functions as the Radom function of VB 6.0,. net PRNG (pseudo-random number generator) produces a much better random number quality.