ComputerCraft Archive

genotp

computer utility kepler155c github

Description

ComputerCraft OS

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/apps/genotp.lua genotp
Archive:wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-apps-genotp genotp
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-apps-genotp genotp

Usage

Run: genotp

Tags

none

Source

View Original Source

Code Preview

local SHA = require("opus.crypto.sha2")

local acceptableCharacters = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
local acceptableCharactersLen = #acceptableCharacters
   
local password = ""

for _i = 1, 8 do
    password = password .. acceptableCharacters[math.random(acceptableCharactersLen)]
end

os.queueEvent("set_otp", SHA.compute(password))

print("Your one-time password is: " .. password)