Suppose here is my class :
class B implements Serializable {
private static final long serialVersionUID = -5186261241138469827L; // what algo is used to generate this
..........
}
What algorithm eclipse uses to generate serialVersionUID = -5186261241138469827L
?
Eclipse implements the relevant Java spec to compute Serialization ID.
In Eclipse, this is implemented by calculateSerialVersionId method in org.eclipse.jdt.internal.ui.text.correction.SerialVersionHashOperation class.
Java Object Serialization Specification Docs ,given that algo
The hash value is assembled from the first and second 32-bit values of the SHA-1 message digest. If the result of the message digest, the five 32-bit words H0 H1 H2 H3 H4, is in an array of five int values named sha, the hash value would be computed as follows:
long hash = ((sha[0] >>> 24) & 0xFF) |
((sha[0] >>> 16) & 0xFF) << 8 |
((sha[0] >>> 8) & 0xFF) << 16 |
((sha[0] >>> 0) & 0xFF) << 24 |
((sha[1] >>> 24) & 0xFF) << 32 |
((sha[1] >>> 16) & 0xFF) << 40 |
((sha[1] >>> 8) & 0xFF) << 48 |
((sha[1] >>> 0) & 0xFF) << 56;