Skip to content

Instantly share code, notes, and snippets.

@TheIndra55
Created April 20, 2021 10:55
Show Gist options
  • Save TheIndra55/a0e4a53f1ba77d7890fe2ac95b03bbd0 to your computer and use it in GitHub Desktop.
Save TheIndra55/a0e4a53f1ba77d7890fe2ac95b03bbd0 to your computer and use it in GitHub Desktop.
BytesToOctets(ipv6.GetAddressBytes());
public static ushort[] BytesToOctets(byte[] bytes)
{
var octets = new ushort[8];
var j = 0;
for(var i = 0; i < bytes.Length; i += 2)
{
octets[j] = (ushort)((bytes[i] << 8) | bytes[i + 1]);
j++;
}
return octets;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment