Skip to content

Instantly share code, notes, and snippets.

@sweetchipsw
Created September 19, 2020 16:02
Show Gist options
  • Save sweetchipsw/ac845c353a59bd53b2cd92e42aa44200 to your computer and use it in GitHub Desktop.
Save sweetchipsw/ac845c353a59bd53b2cd92e42aa44200 to your computer and use it in GitHub Desktop.
blog_matrixvm_4
// 1. 계산을 위한 문제에 정의된 matrix 여러개 생성
mdict[332d]= [[1]
[1]]
mdict[332e]= [[ 1]
[-1]]
// 2. 유저의 Input (25byte) 을 받고 matrix(0x3e8)에 저장시킴
// userinput 은 \x00 * 25개로 설정
mdict[3e8]= [[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]]
// 3. 2번의 matrix와 문제에 정의된 5*5 matrix(알수 없는 데이터가 담긴 행렬)을 곱함.
mdict[3e9]= [[119 101 95 119 105]
[108 108 95 109 105]
[115 115 95 121 111]
[117 95 112 114 111]
[ 99 102 115 46 46]]
mdict[3eb] = mdict[3e8].dot((mdict[3e9]))
// 4. 추가로 알수없는 데이터가 담긴 matrix을 몇개 더 생성하고 3번에서 곱한 matrix의 데이터를 또 좌표별로 가져와서 곱하는 과정을 몇번 반복.
mdict[3ea]= [[41546 8619 53491 12367 19810]
[56577 60086 27970 20573 9151]
[ 3554 50732 45063 30800 48142]
[44842 8366 10332 53130 7242]
[28114 45541 46379 9801 10691]]
mdict[332f][0][0] = mdict[3eb][0][0] 0
mdict[332f][0][1] = mdict[3ea][0][0] 0
mdict[7d0] = mdict[332f].dot((mdict[332d]))
mdict[3eb][0][0] = mdict[7d0][0][0] 0
// 4. 추가로 알수없는 데이터가 담긴 matrix을 몇개 더 생성하고 3번에서 곱한 matrix의 데이터를 또 좌표별로 가져와서 곱하는 과정을 몇번 반복.
mdict[3ec]= [[ 66767 74378 98601 96720 115270 59426 95089 80703 115942 59188
58826 82702 108504 102446 102655 64693 89909 70993 101607 53330
102259 59728 64083 66997 103118]]
mdict[332f][0][0] = mdict[3eb][0][0] 0
mdict[332f][0][1] = mdict[3ec][0][18] 101607
mdict[7fb] = mdict[332f].dot((mdict[332e]))
mdict[3eb][0][0] = mdict[7fb][0][0] 0
// 5. 4번의 결과를 한글자씩 뽑아서 결과가 0인지 확인함. (25번 반복)
// 0번째 플래그 확인
mdict[3330][0][0] = mdict[3eb][0][0] 0
compare : mdict[3330][0][0] == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment