@ddunigma/node 1.0.22 → 1.0.24

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/dist/cjs/index.js CHANGED
@@ -21,7 +21,8 @@ class Ddu64 {
21
21
  this.dduBinaryLookupKr = new Map();
22
22
  this.paddingRegex = new Map();
23
23
  if (typeof dduChar === "string") {
24
- this.dduChar = dduChar.split("");
24
+ const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
25
+ this.dduChar = removeDuplicatesString.trim().split("");
25
26
  }
26
27
  else {
27
28
  this.dduChar = dduChar || this.dduCharKr;
@@ -86,7 +87,7 @@ class Ddu64 {
86
87
  return Buffer.from(buffer);
87
88
  }
88
89
  encode(input, options = {}) {
89
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
90
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
90
91
  const bufferInput = typeof input === "string" ? Buffer.from(input, encoding) : input;
91
92
  const { dduSet, padChar, dduLength, bitLength } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
92
93
  const { dduBinary, padding } = this.bufferToDduBinary(bufferInput, bitLength);
@@ -107,7 +108,7 @@ class Ddu64 {
107
108
  : resultString;
108
109
  }
109
110
  decode(input, options = {}) {
110
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
111
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
111
112
  const { dduSet, dduLength, bitLength, lookupTable, paddingRegExp } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
112
113
  const paddingCount = (input.match(paddingRegExp) || []).length;
113
114
  const paddingBits = paddingCount * 2;
@@ -212,7 +213,8 @@ class Custom64 {
212
213
  this.dduBinaryLookupKr = new Map();
213
214
  this.paddingRegex = new Map();
214
215
  if (typeof dduChar === "string") {
215
- this.dduChar = dduChar.split("");
216
+ const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
217
+ this.dduChar = removeDuplicatesString.trim().split("");
216
218
  }
217
219
  else {
218
220
  this.dduChar = dduChar || this.dduCharKr;
@@ -277,7 +279,7 @@ class Custom64 {
277
279
  return Buffer.from(buffer);
278
280
  }
279
281
  encode(input, options = {}) {
280
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
282
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
281
283
  const bufferInput = typeof input === "string" ? Buffer.from(input, encoding) : input;
282
284
  const { dduSet, padChar, dduLength, bitLength } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
283
285
  const { dduBinary, padding } = this.bufferToDduBinary(bufferInput, bitLength);
@@ -298,7 +300,7 @@ class Custom64 {
298
300
  : resultString;
299
301
  }
300
302
  decode(input, options = {}) {
301
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
303
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
302
304
  const { dduSet, dduLength, bitLength, lookupTable, paddingRegExp } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
303
305
  const paddingCount = (input.match(paddingRegExp) || []).length;
304
306
  const paddingBits = paddingCount * 2;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __1 = require("..");
4
+ const secret = "Asqr0z3ty1524EBCQFRTUWVXYZbacdD+GLHIJKMONfehgPiSklmujvnop9w678x/";
5
+ const padding = "=";
6
+ function encryptDdu64(content) {
7
+ const custom64 = new __1.Custom64();
8
+ const encoded = custom64.encode(content);
9
+ return encoded;
10
+ }
11
+ function decryptDdu64(content) {
12
+ const custom64 = new __1.Custom64();
13
+ const decoded = custom64.decode(content);
14
+ return decoded;
15
+ }
16
+ console.log("타운카 너무좋아123");
17
+ console.log("");
18
+ console.log(encryptDdu64("타운카 너무좋아123"));
19
+ console.log("");
20
+ console.log(decryptDdu64(encryptDdu64("타운카 너무좋아123")));
package/dist/mjs/index.js CHANGED
@@ -20,7 +20,8 @@ export class Ddu64 {
20
20
  paddingRegex = new Map();
21
21
  constructor(dduChar, paddingChar) {
22
22
  if (typeof dduChar === "string") {
23
- this.dduChar = dduChar.split("");
23
+ const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
24
+ this.dduChar = removeDuplicatesString.trim().split("");
24
25
  }
25
26
  else {
26
27
  this.dduChar = dduChar || this.dduCharKr;
@@ -85,7 +86,7 @@ export class Ddu64 {
85
86
  return Buffer.from(buffer);
86
87
  }
87
88
  encode(input, options = {}) {
88
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
89
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
89
90
  const bufferInput = typeof input === "string" ? Buffer.from(input, encoding) : input;
90
91
  const { dduSet, padChar, dduLength, bitLength } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
91
92
  const { dduBinary, padding } = this.bufferToDduBinary(bufferInput, bitLength);
@@ -106,7 +107,7 @@ export class Ddu64 {
106
107
  : resultString;
107
108
  }
108
109
  decode(input, options = {}) {
109
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
110
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
110
111
  const { dduSet, dduLength, bitLength, lookupTable, paddingRegExp } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
111
112
  const paddingCount = (input.match(paddingRegExp) || []).length;
112
113
  const paddingBits = paddingCount * 2;
@@ -212,7 +213,8 @@ export class Custom64 {
212
213
  paddingRegex = new Map();
213
214
  constructor(dduChar, paddingChar) {
214
215
  if (typeof dduChar === "string") {
215
- this.dduChar = dduChar.split("");
216
+ const removeDuplicatesString = [...new Set(dduChar.trim())].join("");
217
+ this.dduChar = removeDuplicatesString.trim().split("");
216
218
  }
217
219
  else {
218
220
  this.dduChar = dduChar || this.dduCharKr;
@@ -277,7 +279,7 @@ export class Custom64 {
277
279
  return Buffer.from(buffer);
278
280
  }
279
281
  encode(input, options = {}) {
280
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
282
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
281
283
  const bufferInput = typeof input === "string" ? Buffer.from(input, encoding) : input;
282
284
  const { dduSet, padChar, dduLength, bitLength } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
283
285
  const { dduBinary, padding } = this.bufferToDduBinary(bufferInput, bitLength);
@@ -298,7 +300,7 @@ export class Custom64 {
298
300
  : resultString;
299
301
  }
300
302
  decode(input, options = {}) {
301
- const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = false, } = options;
303
+ const { dduSetSymbol = "default", encoding = this.defaultEncoding, usePowerOfTwo = true, } = options;
302
304
  const { dduSet, dduLength, bitLength, lookupTable, paddingRegExp } = this.getSelectedSets(dduSetSymbol, usePowerOfTwo);
303
305
  const paddingCount = (input.match(paddingRegExp) || []).length;
304
306
  const paddingBits = paddingCount * 2;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { Custom64 } from "..";
2
+ const secret = "Asqr0z3ty1524EBCQFRTUWVXYZbacdD+GLHIJKMONfehgPiSklmujvnop9w678x/";
3
+ const padding = "=";
4
+ function encryptDdu64(content) {
5
+ const custom64 = new Custom64();
6
+ const encoded = custom64.encode(content);
7
+ return encoded;
8
+ }
9
+ function decryptDdu64(content) {
10
+ const custom64 = new Custom64();
11
+ const decoded = custom64.decode(content);
12
+ return decoded;
13
+ }
14
+ console.log("타운카 너무좋아123");
15
+ console.log("");
16
+ console.log(encryptDdu64("타운카 너무좋아123"));
17
+ console.log("");
18
+ console.log(decryptDdu64(encryptDdu64("타운카 너무좋아123")));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddunigma/node",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/mjs/index.js",
6
6
  "types": "dist/index.d.ts",