SlideShare a Scribd company logo
1 of 158
Download to read offline
Assembly
Language Tanka
SAKAI Hiroaki
(KOZOS Project)
TwitterID:kozossakai
Assembly
Language
Tanka?
What's assembly
language tanka?
Write program in 5+7+5+7+7
machine codes.
It's cool and exciting!
Example
68 72 6c 64 21
68 6f 20 57 6f 90 90
68 48 65 6c 6c
89 e5 6a 0c 55 6a 02
50 90 6a 04 58 cd 80
Write on
Japanese
Tanka card.
Result
Hello World!
in other
languages,
Tanka is impossible
in other programming
languages.
For example,
Shell script
#!/bin/sh
(9 letters!)
For example,
Language C
#include <stdio.h>
(18 letters!)
XSS Tanka?
XSS tanka has
no tankism
Assembly is
most tankable
language
in SECCON
Nagano,
What's displayed?
Assembly
language
tanka's
hanging
scroll!
See well.
Title: Niigata
So,
Let's
tanking!
Title: Summer vacation
Tankist: Me
Check points
See assembly
push $0
pop %eax
push %eax
inc %eax
push $0x616d6179
push %eax
inc %eax
push $8
pop %edx
pop %ebx
inc %eax
push $0x616b6157
push %esp
inc %eax
pop %ecx
int $0x80
pop %eax
pop %eax
pop %eax
ret
Upper
section
Lower
section
See assembly
push $0
pop %eax
push %eax
inc %eax
push $0x616d6179
push %eax
inc %eax
push $8
pop %edx
pop %ebx
inc %eax
push $0x616b6157
push %esp
inc %eax
pop %ecx
int $0x80
pop %eax
pop %eax
pop %eax
ret
Upper
section
Lower
section
Same instruction
in last position.
That is,
Stepped on
the rhyme.
Stepped on
the rhyme
by 0x40
Other
points
push $0
pop %eax
push %eax
inc %eax
push $0x616d6179
push %eax
inc %eax
push $8
pop %edx
pop %ebx
inc %eax
push $0x616b6157
push %esp
inc %eax
pop %ecx
int $0x80
pop %eax
pop %eax
pop %eax
ret
push $0
pop %eax
push %eax
inc %eax
push $0x616d6179
push %eax
inc %eax
push $8
pop %edx
pop %ebx
inc %eax
push $0x616b6157
push %esp
inc %eax
pop %ecx
int $0x80
pop %eax
pop %eax
pop %eax
ret
Set up registers
by value of EAX.
That is,
Like a flow
of a brook.
See instructions
push $0
pop %eax
push %eax
inc %eax
push $0x616d6179
push %eax
inc %eax
push $8
pop %edx
pop %ebx
inc %eax
push $0x616b6157
push %esp
inc %eax
pop %ecx
int $0x80
pop %eax
pop %eax
pop %eax
ret
push $0
pop %eax
push %eax
inc %eax
push $0x616d6179
push %eax
inc %eax
push $8
pop %edx
pop %ebx
inc %eax
push $0x616b6157
push %esp
inc %eax
pop %ecx
int $0x80
pop %eax
pop %eax
pop %eax
ret
Mnemonic has a rhythm,
"push-pop-inc".
Comments
While EAX first set as zero increases every section
by the inc instruction, the value of EAX was diverted
and other parameters are set. This seems to be the
flow of a brook. There is a rhythm which is skipped in
a mnemonic like "push-pop-push-inc, push-push-inc"
and "push-pop-pop-inc, push-push-inc". The sight of
the children who play the side of a brook is made to
consider. The theme the "summer vacation" is often
expressed.
Much
tankassion!
Information
Book of
assembly
language tanka!
Assembly programming
in 31 bytes
World of assembly
language tanka
Tankists:
Sakai Hiroaki
Aiko Kenji
Matsuda Kazuki
Sakai Takeyasu
Takesako Yoshinori
Now on sale!
Event for book! (January 20)
"2014 Let's try assembly language tanka!"
at Mynavi Room
Today's
main
subject!
What is the most
tankaful architecture?
RISC architecture:
Instruction is fixed in 4 bytes.
If flexible instruction,
most architecture has
machine code of even length.
Untankable!
Tankable
architectures
x86(Intel) M32C(Mitsubishi)
MN10300(Panasonic)
RL78(Renesas) RX(Renesas)
Xtensa(Tensilica)
Results
RX(Renesas Electronics)
Assemblymov.l #1, r1
mov.l #10, r3
nop
mov.l #0x6c6c6548, [r0]
nop
mov.l #0x6c72, 8[r0] mov.l #0x6f57206f, 4[r0]
mov.l r0, r2
mov.l #5, r5
int #255
Upper
section
Lower
section
Execution
Hello Worl
(10 letters)
RL78(Renesas Electronics)
Hello Wor
(9 letters)
Others
MN10300
M32C
Hello Wo
Hello!
(8 letters)
(6 letters)
i386/FreeBSD
x86/Linux
Hello World!
Hello World!!
(12 letters)
(13 letters)
Let's
compare.
Before
comparison
For quantification,
a unit is needed.
Define a unit
BPT (Byte per Tanka)
How tankaful
for tanking.
Example on RX
hello Worl
10 letters: 10BPT
Aggregation
M32C 6BPT
MN10300 8BPT
RL78 9BPT
RX 10BPT
i386/FreeBSD12BPT
x86/Linux 13BPT
x86 is very
tankaful
architecture!
(and, Linux too)
Thank you
for my tanking!
Comments
While EAX first set as zero increases every section
by the inc instruction, the value of EAX was diverted
and other parameters are set. This seems to be the
flow of a brook. There is a rhythm which is skipped in
a mnemonic like "push-pop-push-inc, push-push-inc"
and "push-pop-pop-inc, push-push-inc". The sight of
the children who play the side of a brook is made to
consider. The theme the "summer vacation" is often
expressed.
Comments
While EAX first set as zero increases every section
by the inc instruction, the value of EAX was diverted
and other parameters are set. This seems to be the
flow of a brook. There is a rhythm which is skipped in
a mnemonic like "push-pop-push-inc, push-push-inc"
and "push-pop-pop-inc, push-push-inc". The sight of
the children who play the side of a brook is made to
consider. The theme the "summer vacation" is often
expressed.
Comments
While EAX first set as zero increases every section
by the inc instruction, the value of EAX was diverted
and other parameters are set. This seems to be the
flow of a brook. There is a rhythm which is skipped in
a mnemonic like "push-pop-push-inc, push-push-inc"
and "push-pop-pop-inc, push-push-inc". The sight of
the children who play the side of a brook is made to
consider. The theme the "summer vacation" is often
expressed.
Comments
While EAX first set as zero increases every section
by the inc instruction, the value of EAX was diverted
and other parameters are set. This seems to be the
flow of a brook. There is a rhythm which is skipped in
a mnemonic like "push-pop-push-inc, push-push-inc"
and "push-pop-pop-inc, push-push-inc". The sight of
the children who play the side of a brook is made to
consider. The theme the "summer vacation" is often
expressed.
First
Information
SECCON
2013
SECCON
2013
SECCON
2013
SECCON
2013
Contest and
competitive show of
Assembly Language Tanka
(in SECCON Nagano, Oct.2013)
それならば、
これもできるだろうと
いうことで
アセンブラ川柳
6a 48 89 e5 90
6a 01 55 6a 02 50 90
6a 04 58 cd 80
実行結果
H
1文字が
せいいっぱいでした
下の句が無いと
けっこう難しい
まてよ
ということは
こういうのも
可能ということか
アセンブラ
かるた
作ってみた
68 a5 f3 a5 b0
68 a1 bc a5 ea 90 90
68 a5 d5 a5 a3
89 e5 6a 0c 55 6a 02
50 90 6a 04 58 cd 80
68 00 00 a5 a2
68 a5 bb a5 f3 90 90
68 a5 d6 a5 e9
89 e5 6a 0c 55 6a 02
50 90 6a 04 58 cd 80
実行 → フィーリング
実行 → ブラセンア
しかし問題あり
バイナリダンプを
見ると
00000000 68 a5 f3 a5 b0 68 a1 bc |hングhー|
00000008 a5 ea 90 90 68 a5 d5 a5 |リ..hフ|
00000010 a3 89 e5 6a 0c 55 6a 02 |.j.Uj.|
00000018 50 90 6a 04 58 cd 80 |P.j.X.|
00000000 68 00 00 a5 a2 68 a5 bb |h..アhセ|
00000008 a5 f3 90 90 68 a5 d6 a5 |ン..hブ|
00000010 e9 89 e5 6a 0c 55 6a 02 |.j.Uj.|
00000018 50 90 6a 04 58 cd 80 |P.j.X.|
00000000 68 a5 f3 a5 b0 68 a1 bc |hングhー|
00000008 a5 ea 90 90 68 a5 d5 a5 |リ..hフ|
00000010 a3 89 e5 6a 0c 55 6a 02 |.j.Uj.|
00000018 50 90 6a 04 58 cd 80 |P.j.X.|
00000000 68 00 00 a5 a2 68 a5 bb |h..アhセ|
00000008 a5 f3 90 90 68 a5 d6 a5 |ン..hブ|
00000010 e9 89 e5 6a 0c 55 6a 02 |.j.Uj.|
00000018 50 90 6a 04 58 cd 80 |P.j.X.|
読み札を
読み上げた時点で
取り札が
わかってしまう
これでは
競技にできない
xorにかけて
難読化
してみる
b8 5b 0c 5a 29
f7 d8 50 b8 5b 5d 5a 44 (字余り)
f7 d8 50 89 e5
6a 08 55 6a 02 50 90
90 90 6a 04 58 cd 80
実行結果
アセンブ
4文字が
せいいっぱい
でした
バイナリダンプは
00000000 b8 5b 0c 5a 29 f7 d8 50 |[.Z)P|
00000008 b8 5b 5d 5a 44 f7 d8 50 |[]ZDP|
00000010 89 e5 6a 08 55 6a 02 50 |.j.Uj.P|
00000018 90 90 90 6a 04 58 cd 80 |...j.X.|
これなら
読めまい
ふだんは趣味で
こんなことを
やっています
GCCが対応している
CPUアーキテクチャの
アセンブラを
片っ端から出力させて
片っ端から読んでみる
この技術を
アセンブラ短歌に
活かしたい
こんな感じmov 0xfff10, #72
mov a, #108
mov 0xfff10, #101
mov 0xfff10, a
mov 0xfff10, a
mov 0xfff10, #111
mov a, #32
mov 0xfff10, a
mov 0xfff10, #87
mov a, #111
mov 0xfff10, a
mov 0xfff10, #114
nop
nop上の句
下の句
こんな かんじ
実行結果は
SoftwareDesign誌
懐かしの連載
「全国津々浦々!
勉強会&イベント
探訪記」
電子書籍に
なります!
電子書籍に
なります!
した!
達人出版会
TechLIONも
収録されてます!
(vol.1〜4)
高橋さん
ありがとう
ございます
(深謝)
あともうひとつ
マイナビ
すげえ
タイトル
「我思う」
詠み人:私
鑑賞ポイント
実はQuineに
なってます
Quineとは
自分自身を出力する
プログラムのことです
つまり
これを実行すると
これが出力されます
さらに
機械語コードに
注目!
"QUINE"の
5文字が
埋め込んで
あります
つまり
Quineにより
「QUINE」と
出力される!
総評
Quineにより「QUINE」と出力させていることは,
内面 をさらけ出した上で「私を見ろ!」「私は私
だ!」と言っているような 強い自我と 誇りの高さ,
情熱を感じさせ, タイトルの「我思う」にふさわし
い作品になっています. 言いたいことを言った後は
retでなくexitシステムコールで 終わっていることも
過去を振り返らない 意志の強さ が感じられてい
さぎ良く, 一本筋 の通っている作品と言うことが
できるでしょう.
総評
Quineにより「QUINE」と出力させていることは,
内面 をさらけ出した上で「私を見ろ!」「私は私
だ!」と言っているような 強い自我と 誇りの高さ,
情熱を感じさせ, タイトルの「我思う」にふさわし
い作品になっています. 言いたいことを言った後は
retでなくexitシステムコールで 終わっていることも
過去を振り返らない 意志の強さ が感じられてい
さぎ良く, 一本筋 の通っている作品と言うことが
できるでしょう.
総評
Quineにより「QUINE」と出力させていることは,
内面 をさらけ出した上で「私を見ろ!」「私は私
だ!」と言っているような 強い自我と 誇りの高さ,
情熱を感じさせ, タイトルの「我思う」にふさわし
い作品になっています. 言いたいことを言った後は
retでなくexitシステムコールで 終わっていることも
過去を振り返らない 意志の強さ が感じられてい
さぎ良く, 一本筋 の通っている作品と言うことが
できるでしょう.
総評
Quineにより「QUINE」と出力させていることは,
内面 をさらけ出した上で「私を見ろ!」「私は私
だ!」と言っているような 強い自我と 誇りの高さ,
情熱を感じさせ, タイトルの「我思う」にふさわし
い作品になっています. 言いたいことを言った後は
retでなくexitシステムコールで 終わっていることも
過去を振り返らない 意志の強さ が感じられてい
さぎ良く, 一本筋 の通っている作品と言うことが
できるでしょう.
総評
Quineにより「QUINE」と出力させていることは,
内面 をさらけ出した上で「私を見ろ!」「私は私
だ!」と言っているような 強い自我と 誇りの高さ,
情熱を感じさせ, タイトルの「我思う」にふさわし
い作品になっています. 言いたいことを言った後は
retでなくexitシステムコールで 終わっていることも
過去を振り返らない 意志の強さ が感じられてい
さぎ良く, 一本筋 の通っている作品と言うことが
できるでしょう.
総評
Quineにより「QUINE」と出力させていることは,
内面 をさらけ出した上で「私を見ろ!」「私は私
だ!」と言っているような 強い自我と 誇りの高さ,
情熱を感じさせ, タイトルの「我思う」にふさわし
い作品になっています. 言いたいことを言った後は
retでなくexitシステムコールで 終わっていることも
過去を振り返らない 意志の強さ が感じられてい
さぎ良く, 一本筋 の通っている作品と言うことが
できるでしょう.
総評
Quineにより「QUINE」と出力させていることは,
内面 をさらけ出した上で「私を見ろ!」「私は私
だ!」と言っているような 強い自我と 誇りの高さ,
情熱を感じさせ, タイトルの「我思う」にふさわし
い作品になっています. 言いたいことを言った後は
retでなくexitシステムコールで 終わっていることも
過去を振り返らない 意志の強さ が感じられてい
さぎ良く, 一本筋 の通っている作品と言うことが
できるでしょう.
バイナリカレンダー
持ってきてます
こんなの
です
ほしいかたには
あげます
お声がけください
さて本題
そんな
アセンブラ短歌
ですが
いちおう
セキュリティ教育の
目的があります
(詳しくはHP参照)
http://kozos.jp/asm-tanka/
機械語コードは
こんな感じ
SECCONとは何か
セキュリティ競技の
コンテストです
昨年度はCTFという
競技大会が
メインでしたが
今年度のSECCONでは
様々なコンテストが
行われています

More Related Content

Viewers also liked

Affective computing
Affective computingAffective computing
Affective computing
Ankit Moonka
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
Ahmed M. Abed
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
mkazree
 

Viewers also liked (20)

Affective computing
Affective computingAffective computing
Affective computing
 
[ASM]Lab4
[ASM]Lab4[ASM]Lab4
[ASM]Lab4
 
Assembly
AssemblyAssembly
Assembly
 
.NET Framework Projet with C#
.NET Framework Projet with C#.NET Framework Projet with C#
.NET Framework Projet with C#
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
 
Assembly Language -I
Assembly Language -IAssembly Language -I
Assembly Language -I
 
8086 microprocessor lab manual
8086 microprocessor lab manual8086 microprocessor lab manual
8086 microprocessor lab manual
 
Chapt 01 basic concepts
Chapt 01   basic conceptsChapt 01   basic concepts
Chapt 01 basic concepts
 
Processor Basics
Processor BasicsProcessor Basics
Processor Basics
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2
 
Math Puzzle Game By Assembly Language
Math Puzzle Game By Assembly LanguageMath Puzzle Game By Assembly Language
Math Puzzle Game By Assembly Language
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
 

Similar to Assembly Language Tanka - SAKAI Hiroaki (7)

アセンブラ短歌 - 坂井弘亮
アセンブラ短歌 - 坂井弘亮アセンブラ短歌 - 坂井弘亮
アセンブラ短歌 - 坂井弘亮
 
フィーリングで読む40種類のアセンブラ(オープンソースカンファレンス2013 Tokyo/Spring ライトニングトーク)
フィーリングで読む40種類のアセンブラ(オープンソースカンファレンス2013 Tokyo/Spring ライトニングトーク)フィーリングで読む40種類のアセンブラ(オープンソースカンファレンス2013 Tokyo/Spring ライトニングトーク)
フィーリングで読む40種類のアセンブラ(オープンソースカンファレンス2013 Tokyo/Spring ライトニングトーク)
 
アセンブラ短歌 (AVTOKYO2013.5 日本語版)
アセンブラ短歌 (AVTOKYO2013.5 日本語版)アセンブラ短歌 (AVTOKYO2013.5 日本語版)
アセンブラ短歌 (AVTOKYO2013.5 日本語版)
 
アセンブラ短歌(第2回APASEC+第2期サイボウズ・ラボユース合同勉強会)
アセンブラ短歌(第2回APASEC+第2期サイボウズ・ラボユース合同勉強会)アセンブラ短歌(第2回APASEC+第2期サイボウズ・ラボユース合同勉強会)
アセンブラ短歌(第2回APASEC+第2期サイボウズ・ラボユース合同勉強会)
 
バイナリ駄洒落コンテスト
バイナリ駄洒落コンテストバイナリ駄洒落コンテスト
バイナリ駄洒落コンテスト
 
Assembler Haiku - TAKESAKO
Assembler Haiku - TAKESAKOAssembler Haiku - TAKESAKO
Assembler Haiku - TAKESAKO
 
「日本語LaTeX」が多すぎる件について
「日本語LaTeX」が多すぎる件について「日本語LaTeX」が多すぎる件について
「日本語LaTeX」が多すぎる件について
 

Recently uploaded

Recently uploaded (12)

論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 

Assembly Language Tanka - SAKAI Hiroaki