sm_crypto

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

sm crypto

SM_CRYPTO 国家加密算法Dart版本 #
Multiple encryption: #

sm2 (coding)
sm3
sm4

Using #
SM3 #
String data = 'Hello! SM-CRYPTO @Greenking19';
String sm3Encrypt = SM3.encryptString(data);
print('👇 SM3 Encrypt Data:');
print(sm3Encrypt);
copied to clipboard
SM4 #
String key = SM4.createHexKey(key: '1234567890987654');
String data = 'Hello! SM-CRYPTO @greenking19';
print('👇 ECB Encrypt Mode:');
String ebcEncryptData = SM4.encrypt(data: data, key: key);
print('🔒 EBC EncryptptData:\n $ebcEncryptData');
String ebcDecryptData = SM4.decrypt(data: ebcEncryptData, key: key);
print('🔑 EBC DecryptData:\n $ebcDecryptData');

print('👇 CBC Encrypt Mode:');
String iv = SM4.createHexKey(key: '1234567890987654');
String cbcEncryptData = SM4.encrypt(
data: data,
key: key,
mode: SM4CryptoMode.CBC,
iv: iv,
);
print('🔒 CBC EncryptptData:\n $cbcEncryptData');
String cbcDecryptData = SM4.decrypt(
data: cbcEncryptData,
key: key,
mode: SM4CryptoMode.CBC,
iv: iv,
);
print('🔑 CBC DecryptData:\n $cbcDecryptData');
copied to clipboard
SmHelper #
List<int> bytes = SmHelper.utf8ToBytes('@Greenking19');
String string = SmHelper.bytesToUtf8(bytes);
...
copied to clipboard
Installing #
With Dart:
dat pub add sm_crypto
copied to clipboard
With Flutter:
flutter pub add sm_crypto
copied to clipboard
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
sm_crypto: ^1.0.3
copied to clipboard
Import it #
Now in your Dart code, you can use: #
import 'package:sm_crypto/sm_crypto.dart';
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.