TOTP Algorithm Seed Length for HmacSHA512

437 Views Asked by At

I am trying to implement TOTTP algorithm described here: https://www.rfc-editor.org/rfc/rfc6238

Key key = new SecretKeySpec(seed.getBytes(StandardCharsets.UTF_8), "HmacSHA512");

However RFC says that:

Seed for HMAC-SHA512 - 64 bytes
     String seed64 = "3132333435363738393031323334353637383930" +
     "3132333435363738393031323334353637383930" +
     "3132333435363738393031323334353637383930" +
     "31323334";
  1. Is this seed64 64 bytes and what happens if I don't pass a 64 bytes seed at like I do with my key generation (my seed has an arbitrary length)?

  2. Should I use Base64 encoding for my seed?

0

There are 0 best solutions below