2014-01-16 69 views
0

我一直對這個reddit的謎題:可以在不丟失exif數據的情況下對PNG進行加密嗎?

http://www.reddit.com/r/playitforward/comments/1v6jfh/contest_first_one_to_solve_this_riddle_gets_my/

大部分在線程的用戶被難住了。充分披露,我很想贏得獎品,但通過引起注意並尋求幫助,我明白我減少了我的機會,但在這一點上,我想知道形象說什麼比什麼都重要。

我們將密碼縮小到了帶有PNG exif數據的文本文件的URL,但是當以PNG格式打開時,它變爲損壞。這個PNG可能會被加密或故意損壞,以保存exif數據以及解開它的最佳方式是什麼?請注意,數字和「AK」字符串與此線索明確關聯,所以我只能假設可能有一個異步密鑰或由Arjen Kampf Lenstra或其背後的一些憤怒的小孩開創的一些標準。

+0

你是什麼意思PNG encrypte d?它如何加密?加密是一個無損協議,由於加密沒有發生數據丟失 – nrathaus

+0

我知道,這是一個謎題,圖像已損壞,但EXIF數據仍然可見時,它被視爲一個txt文件,所以我想知道這是怎麼回事? – moocow1452

+0

我認爲這是謎語的一部分 – nrathaus

回答

1

當然,使用ImageMagick這樣的:

# Look at rose image before we start, and its header 
identify -verbose rose.jpg 

enter image description here

Image: rose.jpg 
    Format: JPEG (Joint Photographic Experts Group JFIF format) 
    Mime type: image/jpeg 
    Class: DirectClass 
    Geometry: 70x46+0+0 
    Units: Undefined 
    Type: TrueColor 
    Endianess: Undefined 
    Colorspace: sRGB 
    Depth: 8-bit 
    Channel depth: 
    red: 8-bit 
    green: 8-bit 
    blue: 8-bit 
    Channel statistics: 
    Pixels: 3220 
    Red: 
     min: 31 (0.121569) 
     max: 255 (1) 
     mean: 145.56 (0.570825) 
     standard deviation: 69.1755 (0.271277) 
     kurtosis: -1.38839 
     skewness: 0.139004 
     entropy: 0.97057 
    Green: 
     min: 27 (0.105882) 
     max: 255 (1) 
     mean: 89.2475 (0.34999) 
     standard deviation: 52.4516 (0.205693) 
     kurtosis: 2.60505 
     skewness: 1.80798 
     entropy: 0.869705 
    Blue: 
     min: 21 (0.0823529) 
     max: 255 (1) 
     mean: 80.4214 (0.315378) 
     standard deviation: 54.9267 (0.215399) 
     kurtosis: 2.93861 
     skewness: 1.9566 
     entropy: 0.85334 
    Image statistics: 
    Overall: 
     min: 21 (0.0823529) 
     max: 255 (1) 
     mean: 105.076 (0.412064) 
     standard deviation: 59.3109 (0.232592) 
     kurtosis: 1.24657 
     skewness: 1.44732 
     entropy: 0.897872 
    Rendering intent: Perceptual 
    Gamma: 0.454545 
    Chromaticity: 
    red primary: (0.64,0.33) 
    green primary: (0.3,0.6) 
    blue primary: (0.15,0.06) 
    white point: (0.3127,0.329) 
    Background color: white 
    Border color: srgb(223,223,223) 
    Matte color: grey74 
    Transparent color: black 
    Interlace: None 
    Intensity: Undefined 
    Compose: Over 
    Page geometry: 70x46+0+0 
    Dispose: Undefined 
    Iterations: 0 
    Compression: JPEG 
    Quality: 92 
    Orientation: Undefined 
    Properties: 
    date:create: 2015-10-04T18:46:03+01:00 
    date:modify: 2015-10-04T18:46:03+01:00 
    jpeg:colorspace: 2 
    jpeg:sampling-factor: 1x1,1x1,1x1 
    signature: 38a8912b601557d5a377bff360f03804c383c3298b48d9917504b488e8f4152b 
    Artifacts: 
    filename: rose.jpg 
    verbose: true 
    Tainted: False 
    Filesize: 2.65KB 
    Number pixels: 3.22K 
    Pixels per second: 3.22EB 
    User time: 0.000u 
    Elapsed time: 0:01.000 
    Version: ImageMagick 6.9.1-10 Q32 x86_64 2015-10-02 http://www.imagemagick.org 

現在添加註釋到圖像並將其加密爲encrypted.png

convert -comment "Freddy frog" rose.jpg -encipher passphrase.txt encrypted.png 

檢查的頭加密的圖像以查看EXIF數據和評論以及其他數據是否爲visib在其中樂 - 是的,他們是:

identify -verbose encrypted.png 

Image: encrypted.png 
    Format: PNG (Portable Network Graphics) 
    Mime type: image/png 
    Class: DirectClass 
    Geometry: 70x46+0+0 
    Units: Undefined 
    Type: TrueColor 
    Endianess: Undefined 
    Colorspace: sRGB 
    Depth: 8-bit 
    Channel depth: 
    red: 8-bit 
    green: 8-bit 
    blue: 8-bit 
    Channel statistics: 
    Pixels: 3220 
    Red: 
     min: 0 (0) 
     max: 255 (1) 
     mean: 126.755 (0.497077) 
     standard deviation: 73.7824 (0.289343) 
     kurtosis: -1.18047 
     skewness: 0.0142557 
     entropy: 0.99254 
    Green: 
     min: 0 (0) 
     max: 255 (1) 
     mean: 127.937 (0.501712) 
     standard deviation: 75.0501 (0.294314) 
     kurtosis: -1.23185 
     skewness: -0.0233363 
     entropy: 0.992485 
    Blue: 
     min: 0 (0) 
     max: 255 (1) 
     mean: 127.594 (0.500368) 
     standard deviation: 74.64 (0.292706) 
     kurtosis: -1.22352 
     skewness: -0.0177342 
     entropy: 0.992544 
    Image statistics: 
    Overall: 
     min: 0 (0) 
     max: 255 (1) 
     mean: 127.428 (0.499719) 
     standard deviation: 74.4927 (0.292128) 
     kurtosis: -1.21239 
     skewness: -0.00900116 
     entropy: 0.992523 
    Rendering intent: Perceptual 
    Gamma: 0.45455 
    Chromaticity: 
    red primary: (0.64,0.33) 
    green primary: (0.3,0.6) 
    blue primary: (0.15,0.06) 
    white point: (0.3127,0.329) 
    Background color: white 
    Border color: srgb(223,223,223) 
    Matte color: grey74 
    Transparent color: black 
    Interlace: None 
    Intensity: Undefined 
    Compose: Over 
    Page geometry: 70x46+0+0 
    Dispose: Undefined 
    Iterations: 0 
    Compression: Zip 
    Orientation: Undefined 
    Properties: 
    cipher:mode: CTR 
    cipher:nonce: d3d57ca43eacb27a9d72b65ef976923e5b761c7aaaee1d1914d1769ca4834488 
    cipher:type: AES 
    comment: Freddy frog          <--- comment is visible 
    date:create: 2015-10-04T18:48:43+01:00 
    date:modify: 2015-10-04T18:48:43+01:00 
    png:bKGD: chunk was found (see Background color, above) 
    png:cHRM: chunk was found (see Chromaticity, above) 
    png:gAMA: gamma=0.45454544 (See Gamma, above) 
    png:IHDR.bit-depth-orig: 8 
    png:IHDR.bit_depth: 8 
    png:IHDR.color-type-orig: 2 
    png:IHDR.color_type: 2 (Truecolor) 
    png:IHDR.interlace_method: 0 (Not interlaced) 
    png:IHDR.width,height: 70, 46 
    png:sRGB: intent=0 (Perceptual Intent) 
    png:text: 6 tEXt/zTXt/iTXt chunks were found 
    signature: 273e3934027f6ffbcf00b3eca7eb0c576d8fd180e87133112ecacd59225986ee 
    Artifacts: 
    filename: encrypted.png 
    verbose: true 
    Tainted: False 
    Filesize: 10.1KB 
    Number pixels: 3.22K 
    Pixels per second: 3.22EB 
    User time: 0.000u 
    Elapsed time: 0:01.000 
    Version: ImageMagick 6.9.1-10 Q32 x86_64 2015-10-02 http://www.imagemagick.org 

現在看加密圖像 - 垃圾

enter image description here

解密形象decrypted.jpg - 看起來像一朵玫瑰給我:-)

convert encrypted.png -decipher passphrase.txt decrypted.jpg 

enter image description here

相關問題