sm-crypto-v2 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.js +2 -13
- package/dist/index.mjs +2 -13
- package/miniprogram_dist/index.js +2 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
### [1.9.3](https://github.com/Cubelrti/sm-crypto-v2/compare/v1.9.2...v1.9.3) (2024-10-10)
|
6
|
+
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* **sm2:** utf8 to hex [#15](https://github.com/Cubelrti/sm-crypto-v2/issues/15) ([16a714a](https://github.com/Cubelrti/sm-crypto-v2/commit/16a714ad8775381c21b814fab6b1d57c263b3c65))
|
11
|
+
|
5
12
|
### [1.9.2](https://github.com/Cubelrti/sm-crypto-v2/compare/v1.9.1...v1.9.2) (2024-08-16)
|
6
13
|
|
7
14
|
|
package/dist/index.js
CHANGED
@@ -636,19 +636,8 @@ function compressPublicKeyHex(s) {
|
|
636
636
|
return prefix + xHex;
|
637
637
|
}
|
638
638
|
function utf8ToHex(input) {
|
639
|
-
|
640
|
-
|
641
|
-
const words = new Uint32Array((length >>> 2) + 1);
|
642
|
-
for (let i = 0; i < length; i++) {
|
643
|
-
words[i >>> 2] |= (input.charCodeAt(i) & 255) << 24 - i % 4 * 8;
|
644
|
-
}
|
645
|
-
const hexChars = [];
|
646
|
-
for (let i = 0; i < length; i++) {
|
647
|
-
const bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
648
|
-
hexChars.push((bite >>> 4).toString(16));
|
649
|
-
hexChars.push((bite & 15).toString(16));
|
650
|
-
}
|
651
|
-
return hexChars.join("");
|
639
|
+
const bytes = utils2.utf8ToBytes(input);
|
640
|
+
return utils2.bytesToHex(bytes);
|
652
641
|
}
|
653
642
|
function leftPad(input, num) {
|
654
643
|
if (input.length >= num)
|
package/dist/index.mjs
CHANGED
@@ -604,19 +604,8 @@ function compressPublicKeyHex(s) {
|
|
604
604
|
return prefix + xHex;
|
605
605
|
}
|
606
606
|
function utf8ToHex(input) {
|
607
|
-
|
608
|
-
|
609
|
-
const words = new Uint32Array((length >>> 2) + 1);
|
610
|
-
for (let i = 0; i < length; i++) {
|
611
|
-
words[i >>> 2] |= (input.charCodeAt(i) & 255) << 24 - i % 4 * 8;
|
612
|
-
}
|
613
|
-
const hexChars = [];
|
614
|
-
for (let i = 0; i < length; i++) {
|
615
|
-
const bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
616
|
-
hexChars.push((bite >>> 4).toString(16));
|
617
|
-
hexChars.push((bite & 15).toString(16));
|
618
|
-
}
|
619
|
-
return hexChars.join("");
|
607
|
+
const bytes = utils2.utf8ToBytes(input);
|
608
|
+
return utils2.bytesToHex(bytes);
|
620
609
|
}
|
621
610
|
function leftPad(input, num) {
|
622
611
|
if (input.length >= num)
|
@@ -2915,19 +2915,8 @@ function compressPublicKeyHex(s) {
|
|
2915
2915
|
return prefix + xHex;
|
2916
2916
|
}
|
2917
2917
|
function utf8ToHex(input) {
|
2918
|
-
|
2919
|
-
|
2920
|
-
var words = new Uint32Array((length >>> 2) + 1);
|
2921
|
-
for(var i = 0; i < length; i++){
|
2922
|
-
words[i >>> 2] |= (input.charCodeAt(i) & 255) << 24 - i % 4 * 8;
|
2923
|
-
}
|
2924
|
-
var hexChars = [];
|
2925
|
-
for(var i1 = 0; i1 < length; i1++){
|
2926
|
-
var bite = words[i1 >>> 2] >>> 24 - i1 % 4 * 8 & 255;
|
2927
|
-
hexChars.push((bite >>> 4).toString(16));
|
2928
|
-
hexChars.push((bite & 15).toString(16));
|
2929
|
-
}
|
2930
|
-
return hexChars.join("");
|
2918
|
+
var bytes = utf8ToBytes(input);
|
2919
|
+
return bytesToHex(bytes);
|
2931
2920
|
}
|
2932
2921
|
function leftPad(input, num) {
|
2933
2922
|
if (input.length >= num) return input;
|