To encrypt "Hidden Lab" using ROT13, each letter is shifted by 13 positions in the alphabet, while non-alphabetic characters (like spaces) remain unchanged. Here's the step-by-step encryption:
2. i (8th letter) → 8 + 13 = 21 → v
3. d (3rd letter) → 3 + 13 = 16 → q
4. d (3rd letter) → 3 + 13 = 16 → q
5. e (4th letter) → 4 + 13 = 17 → r
6. n (13th letter) → 13 + 13 = 26 → 26 mod 26 = 0 → a
7. (space) →
8. L (11th letter) → 11 + 13 = 24 → Y
9. a (0th letter) → 0 + 13 = 13 → n
10. b (1st letter) → 1 + 13 = 14 → o
Result: Uvqraq Ybo
Python Code to Encrypt "Hidden Lab":
def rot13(text):
result = []
for char in text:
if 'a' <= char <= 'z':
shifted = chr((ord(char) - ord('a') + 13) % 26 + ord('a'))
result.append(shifted)
elif 'A' <= char <= 'Z':
shifted = chr((ord(char) - ord('A') + 13) % 26 + ord('A'))
result.append(shifted)
else:
result.append(char)
return ''.join(result)
input_text = "Hidden Lab"
encrypted_text = rot13(input_text)
print(encrypted_text) # Output: Uvqraq Ybo
Output:
Uvqraq Ybo
Request an On-site Audit / Inquiry