Verticode90 points Solved 126 times Cryptography Arun DunnaWelcome to Verticode, the new method of translating text into vertical codes.
Each verticode has two parts: thecolor shiftand thecode.
The code takes the inputted character and translates it into an ASCII code, and then into binary, then puts that into an image in which each black pixel represents a1and each white pixel represents a0.
For example,A is 65which is1000001in binary,B is 66which is1000010, andC is 67which is1000011, so the corresponding verticode would look like this.
Except, it isn't that simple.
A color shift is also integrated, which means that the color before each verticode shifts the ASCII code, by adding the number that the color corresponds to, before translating it into binary. In that case, the previous verticode could also look like this.
The table for the color codes is:
0 = Red
1 = Purple
2 = Blue
3 = Green
4 = Yellow
5 = Orange
This means that a red color shift for the letterA, which is65 + 0 = 65, would translate into1000001in binary; however, a green color shift for the letterA, which is65 + 3 = 68, would translate into1000100in binary.
Given this verticode, read the verticode into text and find the flag.
Note that the flag will not be in the typicalsctf{flag}format, but will be painfully obvious text. Once you find this text, you will submit it in thesctf{text}format. So, if the text you find isadunnaisawesome, you will submit it assctf{adunnaisawesome}.
![]()
次の画像は、元の値(文字コード)に、左側の色ごとに決められた数値を加算して、白黒のビット化をしています。紫は+1加算、赤は0加算(そのまま)です。したがって、ABCがそれぞれ紫赤紫により、紫A=1000001+1=1000010、赤B=1000010+0=1000010、紫C=1000011+1=1000100になります。
![]()
それでは、問題文の内容をRubyプログラムで書いてみます。
require "RMagick"
include Magick
def get_rgb_arry(file)
img = ImageList.new(file)
str = ""
for y in 0...img.rows/12
ch = 0
color = img.pixel_color(0, y * 12) #色を取得
if color.red == 65535 and color.green == 0 and color.blue == 0 then
add = 0 #赤
elsif color.red == 32896 and color.green == 0 and color.blue == 32896 then
add = 1 #紫
elsif color.red == 0 and color.green == 0 and color.blue == 65535 then
add = 2 #青
elsif color.red == 0 and color.green == 32896 and color.blue == 0 then
add = 3 #緑
elsif color.red == 65535 and color.green == 65535 and color.blue == 0 then
add = 4 #黄
elsif color.red == 65535 and color.green == 42405 and color.blue == 0 then
add = 5 #橙
else
p color.red
p color.green
p color.blue
end
for x in 0..6
src = img.pixel_color(7 * 12 + x * 12, y * 12) #文字を取得
ch = ch << 1
if src.red == 0 then
ch += 1
end
end
str = str + (ch - add).chr
end
return str
end
pic1 = "code1.png"
print get_rgb_arry(pic1)
これを実行すると、下記の文字列を得ることができます。
flagで検索するとABC~DEFで囲まれた部分がヒットします。これをフラグの形式にしてsubmitすると正解でした。JoeLopowasamanofmildtemperamentshortstatureandhadthegoaltobecometheworldsfastesttelephoneeaterThoughLoponeverknewevenbasicphysicshecreatedatelescopecapableofsightingthesmallesthaironanalienwholivedquiteafewlightyearsawayJoeLopoquicklydestroyedalargeboulderandusedtheshatteredremainstoformeightsmallstatuesthatstronglyresembledtinycreaturesbeingorrelatedtothewaterfleaHeplacedtheminacircularpatterntoformasortofshrineandplacedthetelescopeinthemiddleofitHethenchanneledthepowerofthestonewaterfleasintothetelescopetoviewthepoweroftheheavensHewasinatrancewiththebeautyofthemysteriousdimensionanddidntevennoticetheverylargetornadoheadingtowardhimTheshrinewasquicklydemolishedandtheimmediatewithdrawlofpowersentJoeLobointoalairofpitchblacknessfoundtobeaparalleldimensionthatcausABCiamtheflagalllowercasenojokeDEFanyonewhosefirstnamebeganwithJalongwithMLandQtobecomeratheruncomfortableJoewasalsosuddenlyintroducedtoundroclamaticolomphasisciousytheeccentrictapewormwithastrongmorrocanaccentImundroclamaticolomphasisciousytheeccentrictapewormIlikepizzasohowareyadoinIhavenoideasaidJoe
よって、フラグは、
sctf{iamtheflagalllowercasenojoke}
です。









