package mapped;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;

@ObfuscatedName("au")
public class class5 implements class2 {
   @ObfuscatedName("at")
   final MessageDigest field9;

   @ObfuscatedSignature(
      descriptor = "(Lal;)V"
   )
   class5(class8 var1) {
      this.field9 = this.method26_base();
   }

   @ObfuscatedName("at")
   boolean method41_base(int var1, String var2, long var3) {
      byte[] var5 = this.method25_base(var2, var3);
      return method23_base(var5) >= var1;
   }

   @ObfuscatedName("ao")
   byte[] method25_base(String var1, long var2) {
      StringBuilder var4 = new StringBuilder();
      var4.append(var1).append(Long.toHexString(var2));
      this.field9.reset();

      try {
         this.field9.update(var4.toString().getBytes("UTF-8"));
      } catch (UnsupportedEncodingException var6) {
         var6.printStackTrace();
      }

      return this.field9.digest();
   }

   @ObfuscatedName("ab")
   MessageDigest method26_base() {
      MessageDigest var10000;
      try {
         var10000 = MessageDigest.getInstance("SHA-256");
      } catch (NoSuchAlgorithmException var2) {
         var2.printStackTrace();
         return null;
      }

      return var10000;
   }

   @ObfuscatedName("ah")
   static int method23_base(byte[] var0) {
      int var1 = 0;
      byte[] var2 = var0;

      for(int var3 = 0; var3 < var2.length; ++var3) {
         byte var4 = var2[var3];
         int var5 = method40_base(var4);
         var1 += var5;
         if(var5 != 8) {
            break;
         }
      }

      return var1;
   }

   @ObfuscatedName("ar")
   static int method40_base(byte var0) {
      int var1 = 0;
      if(var0 == 0) {
         var1 = 8;
      } else {
         for(int var2 = var0 & 255; (var2 & 128) == 0; var2 <<= 1) {
            ++var1;
         }
      }

      return var1;
   }
}
