private static void calcSignature(byte[] bytes, int len) {
    MessageDigest md;

    try {
      md = MessageDigest.getInstance("SHA-1");
    } catch (NoSuchAlgorithmException ex) {
      throw new RuntimeException(ex);
    }

    md.update(bytes, 32, len - 32);

    try {
      int amt = md.digest(bytes, 12, 20);
      if (amt != 20) {
        throw new RuntimeException("unexpected digest write: " + amt + " bytes");
      }
    } catch (DigestException ex) {
      throw new RuntimeException(ex);
    }
  }
Calculates the signature for the {@code .dex} file in the given array, and modify the array to
contain it.

@param bytes {@code non-null;} the bytes of the file
@param len length of {@code .dex} file encoded in the array
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/DexFile.java