-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于解密判断入参IsBase64的优化建议 #330
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
命名空间:VOL.Core.Extensions
类:ObjectExtension
增加方法:IsBase64String
public static bool IsBase64String(this string base64String)
{
const int bitsEncodedPerChar = 6;
int bytesExpected = (base64String.Length * bitsEncodedPerChar) >> 3;
Span bytesBuffer = stackalloc byte[bytesExpected];
return Convert.TryFromBase64String(base64String, bytesBuffer, out int bytesWritten);
}
命名空间:VOL.Core.Extensions
类:SecurityEncDecryptExtensions
方法:DecryptDES
增加入参判断,优于上下文try catch
if (decryptString.IsNullOrWhiteSpace()|| decryptKey.IsNullOrWhiteSpace() || !decryptString.IsBase64String())
{
return decryptString;
}
The text was updated successfully, but these errors were encountered: