C # in Base64 code, decoding method

xiaoxiao2021-03-06  65

coding

Public string encodebase64 (String code_type, string code)

{

String encode = "";

Byte [] bytes = encoding.getencoding (code_type);

Try

{

ENCODE = Convert.TOBASE64STRING (bytes);

}

Catch

{

ENCODE = CODE;

}

Return ENCODE;

}

decoding

Public string decodebase64 (String code_type, string code)

{

String Decode = "";

Byte [] bytes = convert.FromBase64String (Code);

Try

{

Decode = Encoding.Getencoding (Code_Type) .getstring (bytes);

}

Catch

{

Decode = Code;

}

Return Decode;

}

转载请注明原文地址:https://www.9cbs.com/read-86580.html

New Post(0)