Skip to content

Instantly share code, notes, and snippets.

@JohnCoates
Last active August 8, 2023 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnCoates/6b13c4f94507f1716bd608dccc45e0bc to your computer and use it in GitHub Desktop.
Save JohnCoates/6b13c4f94507f1716bd608dccc45e0bc to your computer and use it in GitHub Desktop.
Instagram private key decoder
let encodedApiKey = [0x72, 0x30, 0x39, 0x04, 0x04, 0x88, 0x72, 0x88, 0x72, 0xEE, 0x04, 0x30, 0x04, 0xEF, 0xEB, 0xC2,
0xEB, 0xEE, 0xAA, 0x41, 0xEE, 0x30, 0x88, 0xC2, 0xC2, 0x2C, 0x04, 0x04, 0x88, 0xAA, 0x41, 0x30,
0x41, 0x72, 0x88, 0x5D, 0x04, 0x2C, 0xAA, 0x58, 0x30, 0x72, 0xEE, 0x39, 0x58, 0xEE, 0xC2, 0x5D,
0xAA, 0x04, 0xE2, 0xEE, 0x58, 0xE2, 0xEE, 0x5D, 0xAA, 0x2C, 0x41, 0x04, 0x88, 0xE2, 0xAA, 0xC2]
let map: [Int: String] = [
0x04: "3",
0x2c: "d",
0x30: "b",
0x39: "c",
0x41: "9",
0x58: "7",
0x5d: "4",
0x72: "2",
0x88: "0",
0xAA: "f",
0xEF: "1",
0xE2: "8",
0xEB: "6",
0xEE: "5",
0xC2: "e"
]
var key = ""
for code in encodedApiKey {
guard let decoded = map[code] else {
fatalError("Couldn't find value for code: \(code)")
}
key += decoded
}
print("key: \(key)")
@zkxnkj
Copy link

zkxnkj commented Apr 16, 2020

how can this be used/

@JohnCoates
Copy link
Author

@zkxnkj

Compile it and run it. It's in Swift

@sarandafl
Copy link

Great work! I read the blog but I didn’t see you mention the version of IG used? This doesn’t seem to be compatible with the latest release

@JohnCoates
Copy link
Author

@sarandafl not sure actually! It was the latest version when the blog was posted.

@prajapatianjay
Copy link

How can we use it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment