import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import javax.inject.Inject; import kotlin.TypeCastException; import kotlin.UByte; import kotlin.collections.CollectionsKt__IterablesKt; import kotlin.collections.CollectionsKt___CollectionsKt; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Intrinsics; import kotlin.text.Charsets; import kotlin.text.Regex; import kotlin.text.StringsKt___StringsKt; public class RequestAuthPinCodeUseCase { public x11 a(String str) { String str2 = str; String str3 = this.g.f; List<Character> list = StringsKt___StringsKt.toList(str); ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(list, 10)); for (Character charValue : list) { arrayList.add(String.valueOf(charValue.charValue())); } List<String> split = new Regex("\\.").split(new Regex("-").split(str3, 0).get(0), 0); String str4 = ""; for (int i2 = 0; i2 < 11; i2++) { StringBuilder V = fw.V(str4); ArrayList arrayList2 = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(split, 10)); for (String str5 : split) { arrayList2.add(((String) arrayList.get((Integer.parseInt((String) arrayList.get((Integer.parseInt(str5) + i2) % 11)) * 2) % 11)) + ((String) arrayList.get((Integer.parseInt((String) arrayList.get((Integer.parseInt(str5) + i2) % 11)) * 7) % 11)) + ((String) arrayList.get((Integer.parseInt((String) arrayList.get((Integer.parseInt(str5) + i2) % 11)) * 42) % 11))); } V.append(CollectionsKt___CollectionsKt.joinToString$default(arrayList2, "", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null)); str4 = V.toString(); } String joinToString$default = CollectionsKt___CollectionsKt.joinToString$default(split, ".", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null); Charset charset = Charsets.UTF_8; if (joinToString$default != null) { byte[] bytes = joinToString$default.getBytes(charset); Intrinsics.checkExpressionValueIsNotNull(bytes, "(this as java.lang.String).getBytes(charset)"); byte[] bytes2 = str4.getBytes(); Mac instance = Mac.getInstance("HmacSHA256"); instance.init(new SecretKeySpec(bytes, "HmacSHA256")); byte[] doFinal = instance.doFinal(bytes2); char[] charArray = "0123456789abcdef".toCharArray(); char[] cArr = new char[(doFinal.length * 2)]; for (int i3 = 0; i3 < doFinal.length; i3++) { byte b2 = doFinal[i3] & UByte.MAX_VALUE; int i4 = i3 * 2; cArr[i4] = charArray[b2 >>> 4]; cArr[i4 + 1] = charArray[b2 & 15]; } String str6 = new String(cArr); Intrinsics.checkExpressionValueIsNotNull(str6, "hm.generateHmac256(messa…tring(\".\").toByteArray())"); StringBuilder V2 = fw.V("androidMobileApp/"); V2.append(this.g.f); String sb = V2.toString(); Long b3 = this.b.b(); Integer valueOf = Integer.valueOf(this.f.a()); g83 g83 = this.a; if (g83 != null) { jc1 jc1 = new jc1(((hz1) g83.a).c(1, "auth/api/1.0/".concat("pincodes"), fw.c0("phone", str2), fw.d0("x-client-info", sb, "x-client-secret", str6), g83)); g83 g832 = this.a; LastRequestedPinCodeInfo lastRequestedPinCodeInfo = new LastRequestedPinCodeInfo(str2, b3); if (g832 != null) { x11 c2 = jc1.c(x11.i(new z73(g832, lastRequestedPinCodeInfo))); if (this.b.b().longValue() - this.e.a() > i.longValue()) { return c(c2, 1, Boolean.TRUE, str, b3); } else if (valueOf.intValue() >= 5) { return this.d.b(valueOf.intValue() + 1); } else { return c(c2, Integer.valueOf(valueOf.intValue() + 1), Boolean.FALSE, str, b3); } } else { throw null; } } else { throw null; } } else { throw new TypeCastException("null cannot be cast to non-null type java.lang.String"); } } x11("79037094319"); }
Write, Run & Share Kotlin code online using OneCompiler’s Kotlin online compiler for free. It’s a modern and fast online playground for Kotlin, supporting the latest version and ideal for learning, experimenting, and sharing code instantly.
Kotlin is a statically typed, modern programming language developed by JetBrains. It runs on the JVM and is fully interoperable with Java. Kotlin is concise, expressive, and safe, and it’s officially supported by Google for Android app development.
The following is a simple Kotlin program that prints a greeting:
fun main() {
println("Hello, OneCompiler!")
}
OneCompiler’s Kotlin editor supports stdin. You can provide input using the I/O tab. Here's a sample program that reads a line of input and prints a greeting:
fun main() {
print("Enter your name: ")
val name = readLine()
println("Hello, $name")
}
val name: String = "OneCompiler" // Immutable
var age: Int = 25 // Mutable
Kotlin supports type inference, so explicit types are optional:
val city = "Hyderabad"
var count = 10
val score = 85
if (score >= 50) {
println("Pass")
} else {
println("Fail")
}
for (i in 1..5) {
println(i)
}
var i = 1
while (i <= 5) {
println(i)
i++
}
var j = 1
do {
println(j)
j++
} while (j <= 5)
fun add(a: Int, b: Int): Int {
return a + b
}
fun greet(name: String) = "Hello, $name"
val items = listOf("apple", "banana", "cherry")
for (item in items) {
println(item)
}
This guide provides a quick reference to Kotlin programming syntax and features. Start coding in Kotlin using OneCompiler’s Kotlin online compiler today!