by
0
7
1,060
0
Top 1% !
Popular
Famous
Easy-to-find
Specified
Refined
OpenSource
Popularity: 22444th place
Created
Modified Jan 12, 2015

Published on:

InputName0sourceString
InputType0string
LanguageCSharp
LicenseMIT_X11
MethodNameProtect
OSWindows
OutputTypestring

Protect

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/286111/Protect?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
using System; using System.Security.Cryptography; using System.Text; public static string Protect(this string sourceString) { var sourceBytes = Encoding.Unicode.GetBytes(sourceString); var encryptedBytes = ProtectedData.Protect(sourceBytes, null, DataProtectionScope.CurrentUser); return Convert.ToBase64String(encryptedBytes); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus