Struct ProtectedInt64
Drop-in replacement for System.Int64 that obfuscates the value in memory and reports tampering to the
Implements
Namespace: GUPS.AntiCheat.Protected
Assembly: cs.temp.dll.dll
Syntax
public struct ProtectedInt64
Constructors
ProtectedInt64(Int64)
Initializes a new protected Int64 with the specified value.
Declaration
public ProtectedInt64(Int64 _Value = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | _Value | Initial value. |
Properties
HasIntegrity
Gets a value indicating whether the protected value still has integrity (i.e. the honeypot has not been tampered with).
Declaration
public bool HasIntegrity { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Value
Gets or sets the unobfuscated value.
Declaration
public Int64 Value { get; set; }
Property Value
| Type | Description |
|---|---|
| Int64 |
Remarks
Reading the value runs an integrity check; if the honeypot has been tampered with, the
Methods
CheckIntegrity()
Returns true when the honeypot still matches the obfuscated value.
Declaration
public bool CheckIntegrity()
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Dispose()
Clears the obfuscated value and the secret.
Declaration
public void Dispose()
Equals(Object)
Returns true when this protected value equals the given object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | Object to compare with. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
GetHashCode()
Returns the hash code of the unobfuscated value.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | Hash code of the unobfuscated value (truncated to 32 bits). |
Overrides
Obfuscate()
Rerolls the secret and re-obfuscates the current value.
Declaration
public void Obfuscate()
OnAfterDeserialize()
Unity deserialization hook; rebuilds the obfuscation state from the deserialized honeypot value.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
Unity serialization hook; writes the true value into the honeypot field.
Declaration
public void OnBeforeSerialize()
ToString()
Returns the string representation of the unobfuscated value.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | The string representation of the unobfuscated value. |
Overrides
Operators
Addition(ProtectedInt64, ProtectedInt64)
Adds two protected values.
Declaration
public static ProtectedInt64 operator +(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| ProtectedInt64 | The sum. |
Division(ProtectedInt64, ProtectedInt64)
Divides the first protected value by the second.
Declaration
public static ProtectedInt64 operator /(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| ProtectedInt64 | The quotient. |
Equality(ProtectedInt64, ProtectedInt64)
Returns true when both protected values represent the same number.
Declaration
public static bool operator ==(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
GreaterThan(ProtectedInt64, ProtectedInt64)
Returns true when the first value is greater than the second.
Declaration
public static bool operator>(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
GreaterThanOrEqual(ProtectedInt64, ProtectedInt64)
Returns true when the first value is greater than or equal to the second.
Declaration
public static bool operator >=(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Implicit(ProtectedInt64 to Int64)
Implicitly unwraps a protected Int64 to its Int64 value.
Declaration
public static implicit operator Int64(ProtectedInt64 _Value)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | _Value | Protected Int64 to unwrap. |
Returns
| Type | Description |
|---|---|
| Int64 | The unobfuscated Int64 value. |
Implicit(Int64 to ProtectedInt64)
Implicitly wraps an Int64 in a protected Int64.
Declaration
public static implicit operator ProtectedInt64(Int64 _Value)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | _Value | Value to wrap. |
Returns
| Type | Description |
|---|---|
| ProtectedInt64 | A protected Int64 holding the given value. |
Inequality(ProtectedInt64, ProtectedInt64)
Returns true when the two protected values represent different numbers.
Declaration
public static bool operator !=(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
LessThan(ProtectedInt64, ProtectedInt64)
Returns true when the first value is less than the second.
Declaration
public static bool operator <(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
LessThanOrEqual(ProtectedInt64, ProtectedInt64)
Returns true when the first value is less than or equal to the second.
Declaration
public static bool operator <=(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Multiply(ProtectedInt64, ProtectedInt64)
Multiplies two protected values.
Declaration
public static ProtectedInt64 operator *(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| ProtectedInt64 | The product. |
Subtraction(ProtectedInt64, ProtectedInt64)
Subtracts the second protected value from the first.
Declaration
public static ProtectedInt64 operator -(ProtectedInt64 v1, ProtectedInt64 v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedInt64 | v1 | First operand. |
| ProtectedInt64 | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| ProtectedInt64 | The difference. |