re
Paste
Login
JavaScript needs to be enabled for the correct display of the page.
-- token here local key = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" local random = require("ccryptolib.random") local aead = require("ccryptolib.aead") local seed = "" -- this isnt exactly secure, but its fine, probably.. for i=1,64 do seed = seed .. string.char(math.random(0, 255)) end random.init(seed) local function encrypt(message) local nonce = random.random(12) local ciphertext, tag = aead.encrypt(key, nonce, message, "") return nonce..tag..ciphertext end local function decrypt(message) local ciphertextLength = #message-12-16 if ciphertextLength < 0 then printError("message too short, this may be caused by other traffic on the same port") return end if ciphertextLength >= 32768 then printError("message too large, this may be caused by other traffic on the same port") return end local nonce, tag, endPos = string.unpack("c12c16", message) local ciphertext = message:sub(endPos) local decryptedMessage = aead.decrypt(key, nonce, tag, ciphertext, "") -- this is nil if auth failed if not decryptedMessage then printError("message auth invalid") return end return decryptedMessage end
Syntax
Auto Detect
Apache Access Log
Apache config
Arduino
ARM Assembly
AsciiDoc
AutoHotkey
Bash
BASIC
Brainfuck
C
Clojure
CMake
CoffeeScript
C++
C#
CSS
D
Dart
Delphi
Diff
Django
DNS Zone
Dockerfile
Batch file (DOS)
dsconfig
Dust
Erlang
Excel formulae
Fortran
F#
G-code (ISO 6983)
GLSL
GML
Go
Gradle
Groovy
Handlebars
Haskell
Haxe
HTML
HTMLbars
HTTP
INI
Java
Javascript
JSON
Julia
Kotlin
Lasso
LaTeX
Leaf
Less
Lisp
Lua
Makefile
Markdown
Mathematica
Matlab
MoonScript
Nginx config
Objective-C
OpenSCAD
Perl
PostgreSQL
php
PHP template
Plain text
PowerShell
.properties
Python
Q
QML
R
Ruby
Rust
Scala
Scheme
SCSS
Shell Session
SQL
Swift
TypeScript
Visual Basic .NET
VBScript
VBScript in HTML
VHDL
Vim Script
Intel x86 Assembly
XML
YAML
Exposure
Public
Unlisted
Folder
No folder
Create Paste
Create as guest