#!/usr/bin/bc -l
#http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf p.92
#print "RSA Key Length? "
l = read()
scale = 14; a = 1/3; b = 2/3; t = l * l(2); m = l(t) # a^b == e (l(a) * b)
n = e( l(m) * b ); o = e( l(t) * a ); p = (1.923 * o * n - 4.69) / l(2)
print "Strength: ", p, "\n"
quit
#According to this equation, if you are using AES256 as your symmetric cipher,
#then this is the minimum RSA key size that will present the same strength:
# $ echo 14446 | ./RSA-NIST.bc
# Strength: 256.00032964845911
#Here is the minimum equivalence for "top secret" AES192:
# $ echo 7295 | ./RSA-NIST.bc
# Strength: 192.00346260354399
#Here is the minimum equivalence for AES128:
# $ echo 2868 | ./RSA-NIST.bc
# Strength: 128.01675571278223
#RFC-7525 specifies that "Implementations MUST NOT negotiate cipher suites
#offering less than 112 bits of security" - complying with this parameter yields
#a new minimum RSA key size:
# $ echo 2127 | ./RSA-NIST.bc
# Strength: 112.01273358822347
#Suprisingly, RSA-2048 does not appear compliant using NIST's equation -
#RSA-2127 should be their new minimum.