Crypto-Danciling line.(ascii 图像
生活随笔
收集整理的這篇文章主要介紹了
Crypto-Danciling line.(ascii 图像
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
題目:
一個字符的 ASCII碼有 8 位,圖像中的每兩個黑色色塊間的路程也為 8 步。
從左上角的色塊出發(fā),向右為 0,向下為 1,連起來就是對應(yīng)字符的 ASCII 碼。
import numpy as np from PIL import Image # 判斷下一步往哪走 def search(arr, x, y):if y + 1 < arr.shape[1] and (arr[x, y + 1, :] != 255).all():return x, y + 1, 0elif x + 1 < arr.shape[0]:return x + 1, y, 1else:return -1, -1, -1 if __name__ == "__main__":image = Image.open("Dancing Line.bmp")array = np.array(image)x = y = 0while True:asc = 0# 每八步拼接成一個字符的 ASCII 碼for _ in range(8):x, y, v = search(array, x, y)if v < 0:exit()asc <<= 1asc |= vprint(chr(asc), end = "")?白給!
總結(jié)
以上是生活随笔為你收集整理的Crypto-Danciling line.(ascii 图像的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: frida使用学习
- 下一篇: crypto——明文攻击