File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -617,5 +617,53 @@ private static string CreateMachineKey(int length)
617617 }
618618
619619 #endregion
620+
621+ #region Base64
622+
623+ #region Base64加密解密
624+ /// <summary>
625+ /// Base64 encrypt
626+ /// </summary>
627+ /// <param name="input">input value</param>
628+ /// <returns></returns>
629+ public static string Base64Encrypt ( string input )
630+ {
631+ return Base64Encrypt ( input , Encoding . UTF8 ) ;
632+ }
633+
634+ /// <summary>
635+ /// Base64 encrypt
636+ /// </summary>
637+ /// <param name="input">input value</param>
638+ /// <param name="encoding">text encoding</param>
639+ /// <returns></returns>
640+ public static string Base64Encrypt ( string input , Encoding encoding )
641+ {
642+ return Convert . ToBase64String ( encoding . GetBytes ( input ) ) ;
643+ }
644+
645+ /// <summary>
646+ /// Base64 decrypt
647+ /// </summary>
648+ /// <param name="input">input value</param>
649+ /// <returns></returns>
650+ public static string Base64Decrypt ( string input )
651+ {
652+ return Base64Decrypt ( input , Encoding . UTF8 ) ;
653+ }
654+
655+ /// <summary>
656+ /// Base64 decrypt
657+ /// </summary>
658+ /// <param name="input">input value</param>
659+ /// <param name="encoding">text encoding</param>
660+ /// <returns></returns>
661+ public static string Base64Decrypt ( string input , Encoding encoding )
662+ {
663+ return encoding . GetString ( Convert . FromBase64String ( input ) ) ;
664+ }
665+ #endregion
666+
667+ #endregion
620668 }
621669}
You can’t perform that action at this time.
0 commit comments