Skip to content

Instantly share code, notes, and snippets.

@calderaro
Created April 2, 2016 01:03
Show Gist options
  • Save calderaro/a998be78005534d7e7d35335058b9f77 to your computer and use it in GitHub Desktop.
Save calderaro/a998be78005534d7e7d35335058b9f77 to your computer and use it in GitHub Desktop.
Longitudinal Redundancy Check (LRC) calculator for a byte array.
public class LRC {
public static byte calculateLRC(byte[] bytes) {
byte LRC = 0;
for (int i = 0; i < bytes.length; i++) {
LRC ^= bytes[i];
}
return LRC;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment