This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Quartz101's profile picture

[MC 1.12.2][CC:Tweaked Only] Romulus, an accelerated security API for CC

Started by Quartz101, 25 June 2018 - 12:43 AM
Quartz101 #1
Posted 25 June 2018 - 02:43 AM
Downloads: https://github.com/s...omulus/releases
Source: https://github.com/steamp0rt/romulus

Romulus is a mod which adds a "secure" API to CC. Currently, it only has two functions.


secure.hash: String text, String type -> String hex_out
secure.random: Integer amount -> table random_bytes

secure.random is generated with Java's SecureRandom.
The current hash types are:

KECCAK_224
KECCAK_256
KECCAK_384
KECCAK_512
SHA3_224
SHA3_256
SHA3_384
SHA3_512
SHAKE128
SHAKE256




License
This mod is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
mod, you can obtain one at http://mozilla.org/MPL/2.0/
Edited on 25 June 2018 - 12:48 AM
Galaxtone #2
Posted 25 June 2018 - 03:01 AM
I know that:

secure.hash(text, type)
which is useful without needing a huge library which is slower since it's lua in java,

but I honestly don't know why you have:

secure.random(length)

When you can easily emulate this feature in lua without any issues:

function random(length)
    local randomTable = {}
    for i = 1, length do
        randomTable[i] = math.random(0, 255)
    end
    return randomTable
end
Edited on 25 June 2018 - 01:05 AM
Quartz101 #3
Posted 25 June 2018 - 03:04 AM
I know that:

secure.hash(text, type)
which is useful without needing a huge library which is slower since it's lua in java,

but I honestly don't know why you have:

secure.random(length)

When you can easily emulate this feature in lua without any issues:

function random(length)
  local randomTable = {}
  for i = 1, length do
	randomTable[i] = math.random(0, 255)
  end
  return randomTable
end

Yes, but the normal math.random isn't secure. It uses java.util.random.
Galaxtone #4
Posted 14 October 2018 - 12:45 AM
I know that:

secure.hash(text, type)
which is useful without needing a huge library which is slower since it's lua in java,

but I honestly don't know why you have:

secure.random(length)

When you can easily emulate this feature in lua without any issues:

function random(length)
  local randomTable = {}
  for i = 1, length do
	randomTable[i] = math.random(0, 255)
  end
  return randomTable
end

Yes, but the normal math.random isn't secure. It uses java.util.random.

What about a secure.random(depth) that returns a secure number between 0 and 2^depth-1