byte passwordHash[] = md.digest(password.getBytes());
FastSerializer fs = new FastSerializer();
fs.writeInt(0); // placeholder for length
fs.writeByte(0); // version
fs.writeString(service); // data service (export|database)
fs.writeString(username);
fs.write(passwordHash);
final ByteBuffer fsBuffer = fs.getBuffer();
final ByteBuffer b = ByteBuffer.allocate(fsBuffer.remaining());
b.put(fsBuffer);
final int size = fsBuffer.limit() - 4;