Comments (5)
128 / 8 = 16(字节)
16 进制串中,0xff = 11111111 = 8位 = 1字节 = 字符串长度2
from sm-crypto.
后端的包是传16位,我传16位的utf8串,加密会报错。这个是一定要32位的16进制串吗?
from sm-crypto.
from sm-crypto.
密钥一般是随机的比特序列,一般随机性比较好的密钥,用字符串是无法表示的,所以一般密钥都会使用 16 进制编码进行表示。
你后端传的 16 位字符串,那你将 16 位字符串做 Hex 编码后变成 32 位的 16 进制字符串传入即可。
from sm-crypto.
后端的包是传16位,我传16位的utf8串,加密会报错。这个是一定要32位的16进制串吗?
是的,你需要手动转成对应的hex串,也可以转成最原始的字节数组
from sm-crypto.
Related Issues (20)
- 提供一个高性能的Java版,采用了BC库
- 一些其他的版本实现,方便取用 HOT 3
- sm4.encrypt的key要求是128比特,可是demo那里的字符是32位。
- uniapp 提示未定义 HOT 4
- sm4密钥 HOT 7
- 基于Dart的国密开源实现 HOT 2
- js加签,java验签始终不通过 HOT 7
- js加密,服务端(java hutool)解密,概率性出现解密失败 HOT 4
- sm2签名 支持r 和 s输出吗 HOT 1
- 能否实现类似spark-md5的功能? HOT 1
- SM3和SM4有原生js的引入的方式吗 HOT 1
- sm3-hmac算出来和openssl算的结果不一样 HOT 2
- 生成的密钥对结构和java的不一样 HOT 2
- sm4加密文件后无法解密 HOT 7
- sm4 加密报错
- 在使用代码混淆后,无法加解密 HOT 1
- vue项目,计算视频文件SM3,大一点的就崩溃 HOT 5
- SM2解密 后台采用hutool,密文加了04,但是还是偶发解密不了,报错InvalidCipherTextException: invalid cipher text HOT 1
- IE 出现兼容问题,建议修改 packjson 的main的路径 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sm-crypto.