Skip to content

Instantly share code, notes, and snippets.

@KINGSABRI
Last active August 29, 2015 14:15
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 KINGSABRI/c3961fb1d83c90995764 to your computer and use it in GitHub Desktop.
Save KINGSABRI/c3961fb1d83c90995764 to your computer and use it in GitHub Desktop.
# Find All sum of 3-values that if we subtract from 0x1035E8EA wil give us 0x1035FFB4
# 0x1035E8EA
# 0x55554d66 -
# 0x55554b66 -
# 0x5555506a -
# ------------
# 0x1035FFB4
CHARS =
[
"01", "02", "03", "04", "05", "06", "07", "08", "09", "0b", "0c", "0e",
"0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a",
"1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26",
"27", "28", "29", "2a", "2b", "2c", "2d", "2e", "30", "31", "32", "33",
"34", "35", "36", "37", "38", "39", "3b", "3c", "3d", "3e", "41", "42",
"43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e",
"4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a",
"5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66",
"67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72",
"73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f"
]
$_permutation = CHARS.permutation(2).to_a
def find_sum_of(value)
ary = []
$_permutation.map do |v1|
$_permutation.map do |v2|
$_permutation.map do |v3|
res = ($_eax.hex - v1.join.hex - v2.join.hex - v3.join.hex).abs
if res == value.hex
ary << [v1, v2 ,v3]
end
end #v3
end #v2
end #v1
pp ary
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment