CSharpTest.Net
EncodeBytes Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > AsciiEncoder Class : EncodeBytes Method

inData

Glossary Item Box

Returns a encoded string of ascii characters that are URI safe

Syntax

Visual Basic (Declaration) 
Public Shared Function EncodeBytes( _
   ByVal inData() As Byte _
) As String
C# 
public static string EncodeBytes( 
   byte[] inData
)

Parameters

inData

Example

Library/Library.Test/TestSafe64Encoding.cs

C#Copy Code
//char count must by multiple of 4 for the compare to work
string encoded = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
byte[] data = Safe64Encoding.DecodeBytes(encoded);
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(encoded);
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded));
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data));
VB.NETCopy Code
'char count must by multiple of 4 for the compare to work
Dim encoded As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
Dim data As Byte() = Safe64Encoding.DecodeBytes(encoded)
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(encoded)
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded))
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys