mail.node
Class ID
java.lang.Object
mail.node.ID
- Direct Known Subclasses:
- NameID
public class ID
- extends java.lang.Object
- Author:
- Arne Müller
Field Summary |
private byte[] |
id
|
static int |
ID_LENGTH
Length of the ID in bytes. |
Constructor Summary |
ID(byte[] keydata)
creates the ID out of the given keydata of a public key
the algorithm is not very complex, so if parts of the key are known,
the data of this ID can easily be used to recreate the key |
ID(java.lang.String s)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
ID_LENGTH
public static final int ID_LENGTH
- Length of the ID in bytes.
A ID-size of 256 bits allows 2^256 different ID's,
assumed there are 2^64 users (which will never happen)
the probability for each two users to have the same key is 2^-256
there are about (2^64)^2 = 2^128 pairs of users
-> the probability that any two users have the same key is less than 2^-256 * 2^128 = 2^-128
thus the probability is very small and we can assume that everybody got a different ID
- See Also:
- Constant Field Values
id
private final byte[] id
ID
public ID(byte[] keydata)
- creates the ID out of the given keydata of a public key
the algorithm is not very complex, so if parts of the key are known,
the data of this ID can easily be used to recreate the key
- Parameters:
keydata
-
ID
public ID(java.lang.String s)
distance
public final int distance(ID other)
- calculates the Hamming-distance between two ID's.
The Hamming-distance is defined as the number of bits
that need to be flipped to get the other key
- Parameters:
other
- ID to calculate the distance to
- Returns:
- the Hamming-distance
toHexChar
private static char toHexChar(int b)
fromHexChar
private static int fromHexChar(char c)
fromHex
private static byte[] fromHex(java.lang.String s)
send
public java.lang.String send()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
hashCode
public final int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
getStoreName
public java.lang.String getStoreName()