Class: Paillier::PrivateKey
- Inherits:
-
Object
- Object
- Paillier::PrivateKey
- Defined in:
- lib/paillier/keys.rb
Instance Attribute Summary collapse
-
#l ⇒ Object
readonly
:nodoc:.
-
#m ⇒ Object
readonly
:nodoc:.
Class Method Summary collapse
-
.from_s(string) ⇒ Object
De-serialize a private key string back into object form.
Instance Method Summary collapse
-
#initialize(l, m) ⇒ PrivateKey
constructor
:nodoc:.
-
#to_s ⇒ Object
Serialize a private key to string form.
Constructor Details
#initialize(l, m) ⇒ PrivateKey
:nodoc:
5 6 7 8 |
# File 'lib/paillier/keys.rb', line 5 def initialize(l,m) # :nodoc: @l = l @m = m end |
Instance Attribute Details
#l ⇒ Object (readonly)
:nodoc:
3 4 5 |
# File 'lib/paillier/keys.rb', line 3 def l @l end |
#m ⇒ Object (readonly)
:nodoc:
3 4 5 |
# File 'lib/paillier/keys.rb', line 3 def m @m end |
Class Method Details
.from_s(string) ⇒ Object
De-serialize a private key string back into object form
Example: >> s = priv.to_s >> newPriv = Paillier::PrivateKey.from_s(s)
> #<Paillier::PrivateKey>
Arguments: string (String)
30 31 32 33 |
# File 'lib/paillier/keys.rb', line 30 def PrivateKey.from_s(string) l,m = string.split(",") return PrivateKey.new(l.to_i, m.to_i) end |
Instance Method Details
#to_s ⇒ Object
Serialize a private key to string form
Example: >> priv, pub = Paillier.generateKeypair(2048) >> priv.to_s
> “110107191408889682017277609474037601699496910…”
17 18 19 |
# File 'lib/paillier/keys.rb', line 17 def to_s return "#{@l},#{@m}" end |