@turnkey/encoding
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -43,2 +43,14 @@ 'use strict'; | ||
/** | ||
* Converts a hex string to an ASCII string. | ||
* @param {string} hexString - The input hex string to convert. | ||
* @returns {string} - The converted ASCII string. | ||
*/ | ||
function hexToAscii(hexString) { | ||
let asciiStr = ""; | ||
for (let i = 0; i < hexString.length; i += 2) { | ||
asciiStr += String.fromCharCode(parseInt(hexString.substr(i, 2), 16)); | ||
} | ||
return asciiStr; | ||
} | ||
/** | ||
* Function to normalize padding of byte array with 0's to a target length. | ||
@@ -135,2 +147,3 @@ * | ||
exports.hexStringToBase64url = hexStringToBase64url; | ||
exports.hexToAscii = hexToAscii; | ||
exports.normalizePadding = normalizePadding; | ||
@@ -137,0 +150,0 @@ exports.stringToBase64urlString = stringToBase64urlString; |
# @turnkey/encoding | ||
## 0.4.0 | ||
### Minor Changes | ||
- added hexToAscii function, useful for converting a raw hex string to a (wallet) mnemonic | ||
## 0.3.0 | ||
@@ -4,0 +10,0 @@ |
@@ -11,2 +11,8 @@ /** | ||
/** | ||
* Converts a hex string to an ASCII string. | ||
* @param {string} hexString - The input hex string to convert. | ||
* @returns {string} - The converted ASCII string. | ||
*/ | ||
export declare function hexToAscii(hexString: string): string; | ||
/** | ||
* Function to normalize padding of byte array with 0's to a target length. | ||
@@ -13,0 +19,0 @@ * |
@@ -43,2 +43,14 @@ 'use strict'; | ||
/** | ||
* Converts a hex string to an ASCII string. | ||
* @param {string} hexString - The input hex string to convert. | ||
* @returns {string} - The converted ASCII string. | ||
*/ | ||
function hexToAscii(hexString) { | ||
let asciiStr = ""; | ||
for (let i = 0; i < hexString.length; i += 2) { | ||
asciiStr += String.fromCharCode(parseInt(hexString.substr(i, 2), 16)); | ||
} | ||
return asciiStr; | ||
} | ||
/** | ||
* Function to normalize padding of byte array with 0's to a target length. | ||
@@ -135,2 +147,3 @@ * | ||
exports.hexStringToBase64url = hexStringToBase64url; | ||
exports.hexToAscii = hexToAscii; | ||
exports.normalizePadding = normalizePadding; | ||
@@ -137,0 +150,0 @@ exports.stringToBase64urlString = stringToBase64urlString; |
{ | ||
"name": "@turnkey/encoding", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.mjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42835
462
1