Module: TTCrypt

Defined in:
lib/ttcrypt.rb,
lib/ttcrypt.rb,
lib/ttcrypt/version.rb,
ext/ttcrypt/ttcrypt_ruby.cpp

Overview

Thrift cryptographics primitives: fast c++ implementation, only strong schemes, releases GVL on long operations so other threads can be executed in parallel.

Defined Under Namespace

Classes: RsaKey

Constant Summary collapse

VERSION =
'0.0.2'

Class Method Summary collapse

Class Method Details

._factorizeObject

.factorize(composite) ⇒ int

Pollard ‘rho’ prime factorization. Allows execution of other ruby threads in parallel (releases GVL)

Returns:

  • (int)

    array of prime factors



10
11
12
13
14
# File 'lib/ttcrypt.rb', line 10

def factorize composite
  hex = composite.to_i.to_s(16)
  hex = '0' + hex if (hex.length & 1) == 1
  _factorize(hex).map { |x| x.to_i(16) }
end