Skip to content

Documents

SCC/楊志璿 edited this page Jun 25, 2023 · 9 revisions

The proof to calculate from OID to RealOp if and only if we have the key.

Refer to: common/include/opcode_enum.hpp

Let RealOpcode be denoted as $\mathbb{O}$, the key as $K$, and the one-way hash function as $H$, where $H(O, K)$ represents the SHA1 hash of RealOpcode $\mathbb{o}$ with key $K$.

We make the following claims:

  1. Claim: Each RealOpcode is associated with a unique SHA1 hash.

Proof: This claim is supported by the properties of the SHA1 hashing algorithm, which produces unique hash values for different inputs.

  1. Claim: The SHA1 hash is calculated based on the opcode and the key.

Proof: This claim is based on the definition of the hash function $H$, which takes both the RealOpcode $\mathbb{O}$ and the key $K$ as inputs.

  1. Claim: If the key is known, the SHA1 hash can be reproduced for any given opcode.

Proof: This claim follows directly from the definition of the hash function $H$. Given the same RealOpcode $\mathbb{O}$ and key $K$, the hash function will always produce the same output.

  1. Claim: By sorting the list of (SHA1, RealOpcode) pairs, we ensure that the array index represents the OI (Opcode Index).

Proof: This claim assumes that the list of (SHA1, RealOpcode) pairs is sorted in ascending order based on the SHA1 values. When sorted in this manner, the index of each pair in the list corresponds to the OI.

  1. Claim: The start number is derived from the last byte of the SHA1 hash of the first element in the list.

Proof: This claim assumes that the SHA1 hash values are represented as byte arrays. Taking the last byte of the first element's SHA1 hash provides the start number for the OID calculation.

  1. Claim: As the array index increases, the OID is determined by adding the array index to the start number.

Proof: This claim implies that the OID is calculated by incrementally adding the array index to the start number obtained in claim 5. This calculation is based on the assumption that the array index represents the OI.

Therefore, we conclude:

  1. Conclusion: If the key is known and consistent, the relationship between RealOpcode and OID can be calculated by reproducing the SHA1 hash for a given opcode, following the indexing and offset logic described in claims 4, 5, and 6.

Proof: This conclusion follows from claims 1, 2, 3, 4, 5, and 6. When the key is known and consistent, the SHA1 hash can be reproduced for any given RealOpcode. By applying the indexing and offset logic described in claims 4, 5, and 6, the relationship between RealOpcode and OID can be determined.

In summary, the proof relies on the determinism and consistency of the SHA1 hash function when calculated with the same key. By utilizing this property, along with the indexing and offset calculations, the relationship between RealOpcode and OID can be established if and only if the key is known.

Clone this wiki locally