Skip to content

Commit

Permalink
Fix aes scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
wizawu committed Feb 3, 2021
1 parent 8ea0ff2 commit a9447cb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions bin/aes-decrypt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/lib/jvm/default-jdk/bin/jjs
#!/usr/bin/env graaljs

var Base64 = Packages.java.util.Base64
var Cipher = Packages.javax.crypto.Cipher
var SecretKeySpec = Packages.javax.crypto.spec.SecretKeySpec

var key = arguments[0]
var secret = Base64.getDecoder().decode(arguments[1])
var key = process.argv[2]
var secret = Base64.getDecoder().decode(process.argv[3])

var cipher = Cipher.getInstance("AES")
var keySpec = new SecretKeySpec(key.getBytes(), "AES")
cipher.init(Cipher.DECRYPT_MODE, keySpec)
var result = new java.lang.String(cipher.doFinal(secret))
echo(result)
console.log(result)
8 changes: 4 additions & 4 deletions bin/aes-encrypt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/lib/jvm/default-jdk/bin/jjs
#!/usr/bin/env graaljs

var Base64 = Packages.java.util.Base64
var Cipher = Packages.javax.crypto.Cipher
var SecretKeySpec = Packages.javax.crypto.spec.SecretKeySpec

var key = arguments[0]
var text = arguments[1].getBytes()
var key = process.argv[2]
var text = process.argv[3].getBytes()

var cipher = Cipher.getInstance("AES")
var keySpec = new SecretKeySpec(key.getBytes(), "AES")
cipher.init(Cipher.ENCRYPT_MODE, keySpec)
var result = Base64.getEncoder().encodeToString(cipher.doFinal(text))
echo(result)
console.log(result)
2 changes: 1 addition & 1 deletion bin/graaljs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

$JAVA_HOME/bin/node --jvm $@
$JAVA_HOME/languages/js/bin/node --jvm --experimental-options --js.nashorn-compat=true $@
2 changes: 1 addition & 1 deletion dotfiles/Xdefaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
URxvt.background: #111
URxvt.font: xft:BPMono:size=9
URxvt.font: xft:CourierPrimeCode:size=11
URxvt.foreground: #ddd
URxvt.geometry: 80x30
URxvt.scrollBar: false
4 changes: 2 additions & 2 deletions dotfiles/hyper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module.exports = {
backgroundColor: '#111',
borderColor: '#222',
padding: '2px 2px',
copyOnSelect: true,
webGLRenderer: true,
copyOnSelect: false,
webGLRenderer: false,
windowSize: [600, 400],
},
localPlugins: ['newcwd'],
Expand Down

0 comments on commit a9447cb

Please sign in to comment.