WSecret class
加密工具类,提供各种加密和哈希功能(聚合类)
该类是一个聚合类,整合了 WHash 和 WEncrypt 的功能,提供统一的接口
Constructors
- WSecret()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
aesDecrypt(
String data, {required String keyStr}) → String - AES 解密(使用 CBC 模式)
-
aesEncrypt(
String data, {required String keyStr, String? ivStr}) → String - AES 加密(使用 CBC 模式)
-
base64Decode(
String data) → String - Base64 解码
-
base64Encode(
String data) → String - Base64 编码
-
generateIV(
{int length = 16}) → String - 生成安全的随机 IV
-
generateKey(
{int length = 32}) → String - 生成安全的随机密钥
-
hashPassword(
String password, {String? salt}) → String - 密码哈希(使用 HMAC-SHA256)
-
hmacSha256(
String data, String key) → String - HMAC-SHA256 哈希
-
md5(
String data) → String - MD5 哈希
-
pathMD5(
String path) → String - 文件 MD5 哈希
-
sha1(
String data) → String - SHA1 哈希
-
sha256(
String data) → String - SHA256 哈希
-
sha512(
String data) → String - SHA512 哈希
-
verifyPassword(
String password, String hash) → bool - 验证密码哈希