Skip to content

Commit

Permalink
getHashCode重载
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Oct 13, 2022
1 parent 26fc021 commit 7121a6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion WindivertDotnet/WinDivertNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static extern bool WinDivertGetParam(
public static extern int WinDivertHelperHashPacket(
WinDivertPacket packet,
int packetLen,
long seed = 0);
long seed);

[DllImport(library, CallingConvention = CallingConvention.Cdecl, SetLastError = true)]
public static extern bool WinDivertHelperParsePacket(
Expand Down
11 changes: 10 additions & 1 deletion WindivertDotnet/WinDivertPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,21 @@ public bool DecrementTTL()
return WinDivertNative.WinDivertHelperDecrementTTL(this, this.length);
}

/// <summary>
/// 获取包的哈希
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return this.GetHashCode(seed: 0L);
}

/// <summary>
/// 获取包的哈希
/// </summary>
/// <param name="seed"></param>
/// <returns></returns>
public int GetHash(long seed = 0L)
public int GetHashCode(long seed)
{
return WinDivertNative.WinDivertHelperHashPacket(this, this.length, seed);
}
Expand Down

0 comments on commit 7121a6e

Please sign in to comment.