BytesToHex() public static méthode

public static BytesToHex ( 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);
        }