yukichant 3.0.2 → 3.0.5

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.
@@ -0,0 +1,57 @@
1
+ name: Node CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ jest:
10
+ runs-on: ubuntu-latest
11
+
12
+ strategy:
13
+ matrix:
14
+ node-version: [ 12.x, 14.x, 16.x ]
15
+
16
+ steps:
17
+ - run: node -v
18
+ - uses: actions/checkout@v2
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v2
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ - run: node -v
24
+ - run: npm ci
25
+ - run: npm test
26
+
27
+ test-on-volta:
28
+ runs-on: ubuntu-latest
29
+
30
+ strategy:
31
+ matrix:
32
+ node-version: [ 12.x, 14.x, 16.x ]
33
+
34
+ steps:
35
+ - uses: actions/checkout@v1
36
+ - uses: volta-cli/action@v1
37
+ with:
38
+ node-version: ${{ matrix.node-version }}
39
+
40
+ - run: node -v
41
+ - uses: actions/checkout@v2
42
+
43
+ - name: install yukichant on local
44
+ run: |
45
+ npm install
46
+ npm install -g ../yukichant
47
+
48
+ - name: mkdir sandbox
49
+ run: mkdir -p ./exec_dir
50
+
51
+ - name: check cli path
52
+ run: which chant
53
+ working-directory: ./exec_dir
54
+
55
+ - run: chant
56
+ working-directory: ./exec_dir
57
+
package/README.md CHANGED
@@ -28,25 +28,13 @@ $ chant
28
28
  水面も灰塵に蒼穹を抗え。
29
29
  ```
30
30
 
31
- ## Develop
31
+ ## Documentation for Developers
32
+ [develop](/doc/develop.md)
32
33
 
33
- install dependency
34
- ```bash
35
- $ npm install
36
- ```
37
-
38
- execute command
39
- ```bash
40
- ## run encode
41
- $ npm run dev unko
42
- ## run decode
43
- $ npm run dev unko | npm run dev -- -d
44
- ```
34
+ ## Thanks
35
+ I named "yukichant" by Nagato Yuki-chan + chant .
36
+ because I want to chant magic words like her.
45
37
 
46
38
  ## LICENSE
47
39
  Apache-2.0
48
40
 
49
- ## Thanks
50
- I named "yukichant" by Nagato Yuki-chan + chant .
51
- becouse I want to chant magic words like her.
52
-
package/data/meisi.json CHANGED
@@ -222,6 +222,7 @@
222
222
  "DC": ["幸運","幸福を"],
223
223
  "DD": ["己が","己の"],
224
224
  "DE": ["古の","古今"],
225
+ "DF": ["立ち上がり"],
225
226
  "E0": ["幻と","幻を"],
226
227
  "E1": ["恵の","恵みを"],
227
228
  "E2": ["具現は","具足を"],
package/doc/develop.md ADDED
@@ -0,0 +1,20 @@
1
+ Develop
2
+ ---
3
+
4
+ ## install dependency
5
+ ```bash
6
+ $ npm install
7
+ ```
8
+
9
+ ## execute command
10
+ ```bash
11
+ ## run encode
12
+ $ npm run dev unko
13
+ ## run decode
14
+ $ npm run dev unko | npm run dev -- -d
15
+ ```
16
+
17
+ ## generate meisi.json
18
+ ```bash
19
+ $ ./raw_data/meisi_json_generator
20
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yukichant",
3
- "version": "3.0.2",
3
+ "version": "3.0.5",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "amanoese/yukichant",
package/src/cli.js CHANGED
@@ -2,9 +2,7 @@
2
2
  import getStdin from 'get-stdin'
3
3
  import chant from './index.js'
4
4
  import fs from 'fs'
5
- import path from 'path'
6
- const dirname = path.dirname(new URL(import.meta.url).pathname)
7
- const { version } = JSON.parse(fs.readFileSync(`${dirname}/../package.json`));
5
+ const { version } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
8
6
 
9
7
  import { Command } from 'commander/esm.mjs';
10
8
  const program = new Command();
@@ -5,13 +5,21 @@ let toNumber = (list,input) => list[input]
5
5
  let revToNumber = (list,input) => list.indexOf(input)
6
6
 
7
7
  let encrypt = (uint8array,roter,refrector) => {
8
- let fase_1 = toNumber(roter,uint8array[0])
9
- let fase_2 = toNumber(refrector,fase_1)
10
- let fase_3 = revToNumber(roter,fase_2)
8
+ let phase_1, phase_2, phase_3;
9
+ let nextRotor = roter;
10
+ const ret = [];
11
11
 
12
- let nextRotor = [ ...roter.slice(1) , roter[0] ]
12
+ for (let v of uint8array) {
13
+ phase_1 = toNumber(nextRotor,v);
14
+ phase_2 = toNumber(refrector,phase_1);
15
+ phase_3 = revToNumber(nextRotor,phase_2);
13
16
 
14
- return [fase_3, ...(uint8array.length <= 1 ? [] : encrypt(uint8array.slice(1),nextRotor,refrector)) ]
17
+ nextRotor = [ ...nextRotor.slice(1) , nextRotor[0] ];
18
+
19
+ ret.push(phase_3);
20
+ }
21
+
22
+ return ret;
15
23
  }
16
24
 
17
25
  export default {
@@ -20,6 +28,5 @@ export default {
20
28
  encrypt,
21
29
  uint8ArrayEncrypt(uint8array) {
22
30
  return this.encrypt(uint8array,this.default_roter,this.refrector);
23
- }
31
+ },
24
32
  }
25
-
@@ -1,26 +0,0 @@
1
- name: Node CI
2
-
3
- on:
4
- pull_request:
5
- branches:
6
- - master
7
-
8
- jobs:
9
- build:
10
- name: build
11
- runs-on: ubuntu-latest
12
-
13
- strategy:
14
- matrix:
15
- node-version: [ 12.x, 14.x, 16.x ]
16
-
17
- steps:
18
- - run: node -v
19
- - uses: actions/checkout@v2
20
- - name: Use Node.js ${{ matrix.node-version }}
21
- uses: actions/setup-node@v2
22
- with:
23
- node-version: ${{ matrix.node-version }}
24
- - run: node -v
25
- - run: npm ci
26
- - run: npm test