BytesToBase64() public static méthode

public static BytesToBase64 ( byte bytes ) : string
bytes byte
Résultat string
Exemple #1
0
        public string Encrypt(string plaintext, StringEncodingType encoding)
        {
            var    bytesIn        = ByteEncoding.StringToBytes(plaintext);
            var    encryptedBytes = Encrypt(bytesIn);
            string returnValue    = null;

            switch (encoding)
            {
            case StringEncodingType.Base64:
                returnValue = ByteEncoding.BytesToBase64(encryptedBytes);
                break;

            case StringEncodingType.Hex:
                returnValue = ByteEncoding.BytesToHex(encryptedBytes);
                break;

            default:
                throw new ArgumentException("Unknown encoding type.");
            }
            Array.Clear(bytesIn, 0, bytesIn.Length);
            Array.Clear(encryptedBytes, 0, encryptedBytes.Length);
            return(returnValue);
        }
 public static string GetEntropy(int length)
 {
     return(ByteEncoding.BytesToBase64(GetRandomBytes(length)));
 }