arxpy.primitives.shacal1 module¶
Shacal-1 cipher.
-
class
arxpy.primitives.shacal1.
Shacal1KeySchedule
[source]¶ Bases:
arxpy.primitives.primitives.KeySchedule
Key schedule function.
-
class
arxpy.primitives.shacal1.
Shacal1Encryption
[source]¶ Bases:
arxpy.primitives.primitives.Encryption
Encryption function.
-
class
arxpy.primitives.shacal1.
Shacal1Cipher
[source]¶ Bases:
arxpy.primitives.primitives.Cipher
-
key_schedule
¶ alias of
Shacal1KeySchedule
-
encryption
¶ alias of
Shacal1Encryption
-
-
class
arxpy.primitives.shacal1.
BvIf
[source]¶ Bases:
arxpy.bitvector.operation.Operation
The function If of SHACAL-1.
-
class
arxpy.primitives.shacal1.
XDIf
(input_diff)[source]¶ Bases:
arxpy.differential.derivative.Derivative
Represent the derivative of the function If w.r.t XOR differences.
-
diff_type
¶
-
is_possible
(output_diff)[source]¶ Return whether the given output
Difference
is possible.An output difference \(\beta\) is possible if exists \(x\) such that \(f_{\alpha} (x) = \beta\).
If the output difference is a constant value, this method returns the
Constant
0b1
or0b0
depending on whether the output difference in possible. If the output difference is symbolic, this method returns a bit-vectorTerm
that evaluates to0b1
or0b0
depending on whether the symbolic output difference is replaced by a valid output difference.
-
has_probability_one
(output_diff)[source]¶ Return whether the input difference propagates to the given output difference with probability one.
-
weight
(output_diff)[source]¶ Return the weight of a possible output
Difference
.Let \(\beta\) be the given output difference. The probability of the differential \(p = Pr(\alpha \xrightarrow{f} \beta)\) is defined as the proportion of \(f_{\alpha}\)-preimages of \(\beta\), that is, \(p \ = \ \# \{ x \ : \ f_{\alpha} (x) = \beta \} / 2^{n}\), where \(n\) is the bit-width of \(x\).
By default, the weight is defined as the closest integer of \(- \log_2(p)\), but some derivatives may consider other definitions of weight.
-
error
()[source]¶ Return the maximum difference between the weight and the exact weight.
This method returns an upper bound (in absolute value) of the maximum difference (over all input and output difference) between the weight and the exact weight.
-
-
class
arxpy.primitives.shacal1.
BvMaj
[source]¶ Bases:
arxpy.bitvector.operation.Operation
The function majority of SHACAL-1.
-
class
arxpy.primitives.shacal1.
XDMaj
(input_diff)[source]¶ Bases:
arxpy.differential.derivative.Derivative
Represent the derivative of the majority function w.r.t XOR differences.
-
diff_type
¶
-
is_possible
(output_diff)[source]¶ Return whether the given output
Difference
is possible.An output difference \(\beta\) is possible if exists \(x\) such that \(f_{\alpha} (x) = \beta\).
If the output difference is a constant value, this method returns the
Constant
0b1
or0b0
depending on whether the output difference in possible. If the output difference is symbolic, this method returns a bit-vectorTerm
that evaluates to0b1
or0b0
depending on whether the symbolic output difference is replaced by a valid output difference.
-
has_probability_one
(output_diff)[source]¶ Return whether the input difference propagates to the given output difference with probability one.
-
weight
(output_diff)[source]¶ Return the weight of a possible output
Difference
.Let \(\beta\) be the given output difference. The probability of the differential \(p = Pr(\alpha \xrightarrow{f} \beta)\) is defined as the proportion of \(f_{\alpha}\)-preimages of \(\beta\), that is, \(p \ = \ \# \{ x \ : \ f_{\alpha} (x) = \beta \} / 2^{n}\), where \(n\) is the bit-width of \(x\).
By default, the weight is defined as the closest integer of \(- \log_2(p)\), but some derivatives may consider other definitions of weight.
-
error
()[source]¶ Return the maximum difference between the weight and the exact weight.
This method returns an upper bound (in absolute value) of the maximum difference (over all input and output difference) between the weight and the exact weight.
-