This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto"); | |
var inputVector = new Buffer("c1234567-zipl-03"); | |
var secretKeyHash = new Buffer("GeN8IfCrdxKxMxFA"); | |
var cipher = crypto.createCipheriv('AES-128-CBC', secretKeyHash, inputVector); | |
cipher.update("Test", 'binary', 'binary'); | |
var encryptedHexNumber = cipher.final('hex'); | |
return "1" + encryptedHexNumber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IvParameterSpec ivSpec = new IvParameterSpec("c1234567-zipl-03".getBytes()); | |
SecretKeySpec keySpec = new SecretKeySpec("GeN8IfCrdxKxMxFA".getBytes(), "AES"); | |
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); | |
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); | |
return "1" + bytesToHex(cipher.doFinal("Test".getBytes())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
domain = require("domain") | |
express = require("express") | |
workerDomain = domain.create() | |
workerDomain.on "error", (err) -> | |
Log.error(err) | |
// Here I wan't to render an error page | |
workerDomain.run () -> | |
server = express() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cluster = require("cluster") | |
domain = require("domain") | |
express = require("express") | |
os = require("os") | |
if cluster.isMaster | |
cluster.fork() for cpu in os.cpus() | |
// Fork new worker if one dies | |
else |