private int?GetGeneration(Common.Cryptography.ISAAC state, ClientPacket packet) { int gen = 0; if (GetFutureGeneration(state.Copy(), packet, ref gen, 10)) { return(gen); } if (GetPastGeneration(state.Copy(), packet, ref gen, 10)) { return(gen); } return(null); }
private bool GetFutureGeneration(Common.Cryptography.ISAAC state, ClientPacket packet, ref int Generation, int limit) { limit--; if (limit < 1) { return(false); } Generation++; uint x = state.GetOffset(); if (packet.VerifyChecksum(x)) { return(true); } else { return(GetFutureGeneration(state, packet, ref Generation, limit)); } }
private Common.Cryptography.ISAAC GetGeneration(Common.Cryptography.ISAAC current, int cursor) { if (cursor > 0) { for (int i = 0; i < cursor; i++) { current.GetOffset(); } return(current); } else if (cursor < 0) { for (int i = 0; i > cursor; i--) { current = current.Parent; } return(current); } else if (cursor == 0) { return(current); } return(null); }