Example #1
0
 /**
  * Constructor. This is a special case where the expected format is like 'digestname:value'.
  *
  * @param aValue the value to parse.
  */
 @JsonCreator
 public Digest(final String aValue) {
   final String[] parts = aValue.split(":");
   this.algorithm = parts[0];
   this.content = StringOperations.hexToBytes(parts[1]);
 }
Example #2
0
 /**
  * Constructor.
  *
  * @param anAlgorithm the Algorithm to use.
  * @param aHexValue the Digest value, as hexadecimal characters.
  */
 public Digest(final String anAlgorithm, final String aHexValue) {
   this.algorithm = anAlgorithm;
   this.content = StringOperations.hexToBytes(aHexValue);
 }
Example #3
0
 /**
  * Output the algorithm and value as one whole, separated by joinChar.
  *
  * @param aJoinChar the character to join algorithm and value.
  * @return a string.
  */
 public String toString(final char aJoinChar) {
   return this.algorithm + aJoinChar + StringOperations.hexify(content);
 }
Example #4
0
 /**
  * Get a pretty representation of the algorithm and the value of the digest.
  *
  * @param theJoinChar the character to join algorithms and value.
  * @return a string.
  */
 public String prettyPrint(final String theJoinChar) {
   return this.algorithm
       + theJoinChar
       + StringOperations.split(StringOperations.hexify(content), HEX_GROUP_SIZE);
 }
Example #5
0
 /**
  * Convert the value to hex.
  *
  * @return a hexadecimal representation of the digest value.
  */
 public String toHex() {
   return StringOperations.hexify(content);
 }