diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-02-22 13:01:37 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-02-22 13:01:37 -0600 |
| commit | 13ef4440d01b606e07c5e96f0f0117ead2ba9f1c (patch) | |
| tree | 1efc204bc23690aa3bc0beffd478721ccdcd4f28 /src/helpers.cr | |
| parent | 225625a0fbbcf4af4551b8a1a29db916923a2649 (diff) | |
| download | invidious-13ef4440d01b606e07c5e96f0f0117ead2ba9f1c.tar.gz invidious-13ef4440d01b606e07c5e96f0f0117ead2ba9f1c.tar.bz2 invidious-13ef4440d01b606e07c5e96f0f0117ead2ba9f1c.zip | |
Replace signature function with generic catchall
Diffstat (limited to 'src/helpers.cr')
| -rw-r--r-- | src/helpers.cr | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/src/helpers.cr b/src/helpers.cr index 9ce527a7..d3c89e03 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -175,54 +175,24 @@ def search(query, client) end end -def swap(a, b) +def splice(a, b) c = a[0] a[0] = a[b % a.size] a[b % a.size] = c return a end -def decrypt_signature(a, base) +def decrypt_signature(a) a = a.split("") - case base - when "vflG9lb96" - a = swap(a, 26) - a.reverse! - a = swap(a, 8) - a = swap(a, 61) - when "vflxuxnEY" - a.delete_at(0..2) - a.reverse! - c = a[0] - a[0] = a[49 % a.size] - a[49] = c - when "vflAXQwEj" - a = swap(a, 26) - a.reverse! - a = swap(a, 8) - a = swap(a, 61) - when "vflNpPGQq" - a = swap(a, 26) - a.reverse! - a = swap(a, 8) - a = swap(a, 61) - when "vflCCoUi2" - a = swap(a, 26) - a.reverse! - a = swap(a, 8) - a = swap(a, 61) - when "vflg4IfMn" - a = swap(a, 6) - a = swap(a, 64) - a = swap(a, 25) - a = swap(a, 53) - a.delete_at(0..1) - a.reverse! - a.delete_at(0..2) - else - raise "Could not decrypt signature for player #{base}" - end + a.delete_at(0..1) + a = splice(a, 2) + a = splice(a, 51) + a = splice(a, 9) + a.delete_at(0..1) + a.reverse! + a = splice(a, 15) + a.delete_at(0..2) return a.join("") end |
