Class: MlDsa::ParameterSet
- Inherits:
-
Object
- Object
- MlDsa::ParameterSet
- Includes:
- Comparable
- Defined in:
- lib/ml_dsa/parameter_set.rb
Overview
Encapsulates a concrete ML-DSA parameter set (44, 65, or 87).
Obtain instances via the ML_DSA_44, ML_DSA_65, ML_DSA_87 constants;
do not call new directly. Supports Comparable ordering by security
level: ML_DSA_44 < ML_DSA_65 < ML_DSA_87.
Instance Attribute Summary collapse
-
#code ⇒ Integer
readonly
Numeric code (44, 65, or 87).
-
#name ⇒ String
readonly
Human-readable name, e.g.
-
#public_key_bytes ⇒ Integer
readonly
Public key size in bytes.
-
#secret_key_bytes ⇒ Integer
readonly
Secret key size in bytes.
-
#security_level ⇒ Integer
readonly
NIST security level (2, 3, or 5).
-
#signature_bytes ⇒ Integer
readonly
Signature size in bytes.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(name, code, security_level, pk, sk, sig) ⇒ ParameterSet
constructor
A new instance of ParameterSet.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, code, security_level, pk, sk, sig) ⇒ ParameterSet
Returns a new instance of ParameterSet.
25 26 27 28 29 30 31 32 33 |
# File 'lib/ml_dsa/parameter_set.rb', line 25 def initialize(name, code, security_level, pk, sk, sig) @name = name.freeze @code = code @security_level = security_level @public_key_bytes = pk @secret_key_bytes = sk @signature_bytes = sig freeze end |
Instance Attribute Details
#code ⇒ Integer (readonly)
Returns numeric code (44, 65, or 87).
15 16 17 |
# File 'lib/ml_dsa/parameter_set.rb', line 15 def code @code end |
#name ⇒ String (readonly)
Returns human-readable name, e.g. "ML-DSA-44".
13 14 15 |
# File 'lib/ml_dsa/parameter_set.rb', line 13 def name @name end |
#public_key_bytes ⇒ Integer (readonly)
Returns public key size in bytes.
19 20 21 |
# File 'lib/ml_dsa/parameter_set.rb', line 19 def public_key_bytes @public_key_bytes end |
#secret_key_bytes ⇒ Integer (readonly)
Returns secret key size in bytes.
21 22 23 |
# File 'lib/ml_dsa/parameter_set.rb', line 21 def secret_key_bytes @secret_key_bytes end |
#security_level ⇒ Integer (readonly)
Returns NIST security level (2, 3, or 5).
17 18 19 |
# File 'lib/ml_dsa/parameter_set.rb', line 17 def security_level @security_level end |
#signature_bytes ⇒ Integer (readonly)
Returns signature size in bytes.
23 24 25 |
# File 'lib/ml_dsa/parameter_set.rb', line 23 def signature_bytes @signature_bytes end |
Instance Method Details
#<=>(other) ⇒ Object
35 36 37 38 |
# File 'lib/ml_dsa/parameter_set.rb', line 35 def <=>(other) return nil unless other.is_a?(ParameterSet) @security_level <=> other.security_level end |
#inspect ⇒ Object
44 45 46 |
# File 'lib/ml_dsa/parameter_set.rb', line 44 def inspect "#<MlDsa::ParameterSet #{@name}>" end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/ml_dsa/parameter_set.rb', line 40 def to_s @name end |