Rating:

```java
import java.util.Base64;
import java.util.Scanner;

public class mysteryMethods{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Flag: ");
String userInput = scanner.nextLine();
String encryptedInput = encryptInput(userInput);

if (checkFlag(encryptedInput)) {
System.out.println("Correct flag! Congratulations!");
} else {
System.out.println("Incorrect flag! Please try again.");
}
}

public static String encryptInput(String input) {
String flag = input;
flag = unknown2(flag, 345345345);
flag = unknown1(flag);
flag = unknown2(flag, 00000);
flag = unknown(flag, 25);
return flag;
}

public static boolean checkFlag(String encryptedInput) {
return encryptedInput.equals("OS1QYj9VaEolaDgTSTXxSWj5Uj5JNVwRUT4vX290L1ondF1z");
}

public static String unknown(String input, int something) {
StringBuilder result = new StringBuilder();
for (char c : input.toCharArray()) {
if (Character.isLetter(c)) {
char base = Character.isUpperCase(c) ? 'A' : 'a';
int offset = (c - base + something) % 26;
if (offset < 0) {
offset += 26;
}
c = (char) (base + offset);
}
result.append(c);
}
return result.toString();
}

public static String unknown1(String xyz) {
return new StringBuilder(xyz).reverse().toString();
}

public static String unknown2(String xyz, int integer) {
return Base64.getEncoder().encodeToString(xyz.getBytes());
}
}
```

![image](https://github.com/jeromepalayoor/ctf-archive-hub/assets/63996033/6234214b-bfb4-447d-9679-1802138b66bb)

`unknown` looks like caesar cipher shift.

![image](https://github.com/jeromepalayoor/ctf-archive-hub/assets/63996033/fb7f5521-6354-4536-89dd-7c2f5f51ff29)

`unknown1` looks like it reverses the string

![image](https://github.com/jeromepalayoor/ctf-archive-hub/assets/63996033/bd278258-59cc-41a9-aaaa-03bd5aff8a7a)

`unknown2` looks like a base64 encoder

![image](https://github.com/jeromepalayoor/ctf-archive-hub/assets/63996033/6d821d2e-7c9b-47d9-b646-45a34c20b4d0)

Reverse the encoded string using [cyberchef](https://gchq.github.io/CyberChef/#recipe=ROT13(true,true,false,27)From_Base64('A-Za-z0-9%2B/%3D',true,false)Reverse('Character')From_Base64('A-Za-z0-9%2B/%3D',true,false)&input=T1MxUVlqOVZhRW9sYURnVFNUWHhTV2o1VWo1Sk5Wd1JVVDR2WDI5MEwxb25kRjF6)

![image](https://github.com/jeromepalayoor/ctf-archive-hub/assets/63996033/1c002b36-f732-470a-91ef-bef87f6ce42f)

Flag: `flag{hsCTF_I5_r3aLLy_fUN}`

Original writeup (https://jpalayoor.com/reverse/HSCTF-10.html#mystery-methods).