From 7e7591d28f9a564c2d40d2760fbd48ecaf08c3aa Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 27 Oct 2024 17:55:35 -0600 Subject: [PATCH] Update README --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 152f7e3..5e13c51 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # CCryptoLib An integrated collection of cryptographic primitives written in Lua using the ComputerCraft system API. +## Installation +A simple install script is provided, just run the following command: `wget run https://git.chrischro.me/ChrisChrome/ccryptolib/raw/branch/main/install.lua` + +## Initialization +An `init.lua` is provided to allow easier access to all modules, use `crypto = require("ccryptolib")` in your script to use the module! + ## Initializing the Random Number Generator All functions that take secret input may query the library's random generator, `ccryptolib.random`. CC doesn't have high-quality entropy sources, so instead of @@ -11,7 +17,7 @@ hoping for the best like other libraries do, CCryptoLib shifts that burden into If you trust the tmpim Krist node, you can fetch a socket token and use it for initialization: ```lua -local random = require "ccryptolib.random" +local crypto = require("ccryptolib") -- Fetch a WebSocket token. local postHandle = assert(http.post("https://krist.dev/ws/start", "")) @@ -19,7 +25,7 @@ local data = textutils.unserializeJSON(postHandle.readAll()) postHandle.close() -- Initialize the generator using the given URL. -random.init(data.url) +crypto.random.init(data.url) -- Be polite and actually open the socket too. http.websocket(data.url).close() @@ -29,6 +35,6 @@ http.websocket(data.url).close() As of v1.2.0, you can also initialize the generator using VM instruction timing noise. See the `random.initWithTiming` method for security risks of taking this approach. ```lua -local random = require "ccryptolib.random" -random.initWithTiming() +local crypto = require("ccryptolib") +crypto.random.initWithTiming() ```