Code example for Mac

Methods: doFinal

0
   */ 
  public PasscodeGenerator(final Mac mac, int passCodeLength) {
    this(new Signer() { 
      @Override 
      public byte[] sign(byte[] data){
        return mac.doFinal(data);
      } 
    }, passCodeLength);
  } 
 
  public PasscodeGenerator(Signer signer, int passCodeLength) {
    if ((passCodeLength < 0) || (passCodeLength > MAX_PASSCODE_LENGTH)) {
      throw new IllegalArgumentException(
        "PassCodeLength must be between 1 and " + MAX_PASSCODE_LENGTH
        + " digits."); 
    } 
    this.signer = signer;
    this.codeLength = passCodeLength;
  } 
 
  private String padOutput(int value) {