## Slide 3

### Slide 3 text

ॴଐ • 48&5άϧʔϓˏ%F/" • ςετࣗಈԽνʔϜɿJ04(Pݴޠ ޷͖ͳ΋ͷ • ݴޠɿ4XJGUɺ)BTLFMMɺ-JTQʢʁʣ • झຯɿɺαΠΫϦϯάɺొࢁ ίϛϡχςΟ • ϖϯΪϯଜ ۙگ • USZ4XJGU50,:0Ͱొஃ Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 3 ෼τʔΫ :VTVLF)PTPOVNB!UPCJʢͱͼʣ

## Slide 14

### Slide 14 text

14 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 1 ʴ 0 ʹ 1 1 ʴ 1 ʹ 2 ௨ৗͷςετ ೖྗ஋ ظ଴஋ ໌֬ͳೖྗ஋ͱظ଴஋Λ ༩͑ͯݕূ͢Δ

## Slide 15

### Slide 15 text

15 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ௨ৗͷςετ import "testing" func TestAdd(t *testing.T) { tests := []struct { x int y int want int }{ {x: 0, y: 1, want: 1}, // 0 + 1 = 1 {x: 1, y: 1, want: 2}, // 1 + 1 = 2 } for _, tt := range tests { if got := Add(tt.x, tt.y); got != tt.want { t.Errorf("Add() = %v, want %v", got, tt.want) } } }

## Slide 16

### Slide 16 text

16 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ௨ৗͷςετ import "testing" func TestAdd(t *testing.T) { tests := []struct { x int y int want int }{ {x: 0, y: 1, want: 1}, // 0 + 1 = 1 {x: 1, y: 1, want: 2}, // 1 + 1 = 2 } for _, tt := range tests { if got := Add(tt.x, tt.y); got != tt.want { t.Errorf("Add() = %v, want %v", got, tt.want) } } } ໌֬ͳʮೖྗ஋ʯͱʮظ଴஋ʯΛ༩͑Δ

## Slide 21

### Slide 21 text

21 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. x ʴ y ʹ z y ʴ x ʹ z’ ϥϯμϜςετ ೖྗ஋ ଍͠ࢉ͸ަ׵๏ଇΛຬͨ͢ͷͰ [ͱ[`͸ৗʹҰக͢Δ ϥϯμϜ஋ʹରͯ͠ ຬͨ͢΂͖ੑ࣭Λݕূ͢Δ

## Slide 22

### Slide 22 text

22 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ϥϯμϜςετ import ( "testing" "testing/quick" ) func TestAddQuick(t *testing.T) { f := func(x, y int) bool { return Add(x, y) == Add(y, x) } if err := quick.Check(f, nil); err != nil { t.Error(err.Error()) } }

## Slide 23

### Slide 23 text

23 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ϥϯμϜςετ import ( "testing" "testing/quick" ) func TestAddQuick(t *testing.T) { f := func(x, y int) bool { return Add(x, y) == Add(y, x) } if err := quick.Check(f, nil); err != nil { t.Error(err.Error()) } } UFTUJOHRVJDLΛJNQPSU

## Slide 24

### Slide 24 text

24 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ϥϯμϜςετ import ( “testing" "testing/quick" ) func TestAddQuick(t *testing.T) { f := func(x, y int) bool { return Add(x, y) == Add(y, x) } if err := quick.Check(f, nil); err != nil { t.Error(err.Error()) } } νΣοΫ༻ͷϔϧύʔؔ਺ ϥϯμϜͳೖྗ஋͕ೖͬͯ͘Δ૝ఆ

## Slide 25

### Slide 25 text

25 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ϥϯμϜςετ import ( "testing" "testing/quick" ) func TestAddQuick(t *testing.T) { f := func(x, y int) bool { return Add(x, y) == Add(y, x) } if err := quick.Check(f, nil); err != nil { t.Error(err.Error()) } } ަ׵๏ଇΛຬͨͤ͹USVF

## Slide 26

### Slide 26 text

26 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ϥϯμϜςετ import ( "testing" "testing/quick" ) func TestAddQuick(t *testing.T) { f := func(x, y int) bool { return Add(x, y) == Add(y, x) } if err := quick.Check(f, nil); err != nil { t.Error(err.Error()) } } ؔ਺͕ৗʹUSVFΛฦ͔͢ςετ

## Slide 27

### Slide 27 text

27 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ϥϯμϜςετ import ( "testing" "testing/quick" ) func TestAddQuick(t *testing.T) { f := func(x, y int) bool { return Add(x, y) == Add(y, x) } if err := quick.Check(f, nil); err != nil { t.Error(err.Error()) } } USVFΛฦ͞ͳ͍৔߹͸&SSPS͕ฦ٫

## Slide 31

### Slide 31 text

31 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ࣦഊ͢Δέʔε func Add(x, y int) int { return x - y } // ίϯιʔϧग़ྗ --- FAIL: TestAddQuick (0.00s) #1: failed on input -8046014121776288896, -2929560796466791850 Y Z

## Slide 32

### Slide 32 text

32 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ࣦഊ͢Δέʔε func Add(x, y int) int { return x - y } // ίϯιʔϧग़ྗ --- FAIL: TestAddQuick (0.00s) #1: failed on input -8046014121776288896, -2929560796466791850 Y Z ͜ΕΒͷ஋ͷ৔߹ʹࣦഊͨ͠ͱ͍͏ใࠂ

## Slide 40

### Slide 40 text

40 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ᶃ ໌നͳ࣮૷ͱͷൺֱ • ໌നͳ࣮૷ • ͍͍ͨͯͷ৔߹ɺ஗͍ • ྫɿϑΟϘφον਺ྻΛ࠶ؼͰղ͘ • ͦ͏Ͱͳ͍࣮૷ • ͍͍ͨͯͷ৔߹ɺෳࡶ • ྫɿϑΟϘφον਺ྻΛ຤ඌ࠶ؼͰղ͘ ͲͪΒ΋ಉ͡ೖྗʹରͯ͠͸ ඞͣಉ݁͡ՌΛฦ͢͸ͣ

## Slide 42

### Slide 42 text

42 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. \$POTUBOU5JNF#ZUF&Rؔ਺ // ConstantTimeByteEq returns 1 if x == y and 0 otherwise. func ConstantTimeByteEq(x, y uint8) int { return int((uint32(x^y) - 1) >> 31) } ςετର৅

## Slide 43

### Slide 43 text

43 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. \$POTUBOU5JNF#ZUF&Rؔ਺ // ConstantTimeByteEq returns 1 if x == y and 0 otherwise. func ConstantTimeByteEq(x, y uint8) int { return int((uint32(x^y) - 1) >> 31) } YͱZΛఆ਺࣌ؒͰൺֱ͢Δ Ұக͢Ε͹ɺҰக͠ͳ͚Ε͹Λฦ͢ ςετର৅

## Slide 44

### Slide 44 text

44 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. \$POTUBOU5JNF#ZUF&Rؔ਺ func byteEq(a, b uint8) int { if a == b { return 1 } return 0 } func TestConstantTimeByteEq(t *testing.T) { err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) if err != nil { t.Error(err) } } ςετίʔυ

## Slide 45

### Slide 45 text

45 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. \$POTUBOU5JNF#ZUF&Rؔ਺ func byteEq(a, b uint8) int { if a == b { return 1 } return 0 } func TestConstantTimeByteEq(t *testing.T) { err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) if err != nil { t.Error(err) } } ఆ਺࣌ؒͰ͸ͳ͍໌നͳൺֱؔ਺ ςετίʔυ

## Slide 46

### Slide 46 text

46 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. \$POTUBOU5JNF#ZUF&Rؔ਺ func byteEq(a, b uint8) int { if a == b { return 1 } return 0 } func TestConstantTimeByteEq(t *testing.T) { err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) if err != nil { t.Error(err) } } ςετ༻ͷؔ਺ ςετίʔυ

## Slide 47

### Slide 47 text

47 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. \$POTUBOU5JNF#ZUF&Rؔ਺ func byteEq(a, b uint8) int { if a == b { return 1 } return 0 } func TestConstantTimeByteEq(t *testing.T) { err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) if err != nil { t.Error(err) } } ͭͷؔ਺ʹ͍ͭͯಉ݁͡ՌΛฦ͢͜ͱ ςετର৅ ໌നͳ࣮૷ ςετίʔυ

## Slide 48

### Slide 48 text

48 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. \$POTUBOU5JNF#ZUF&Rؔ਺ func byteEq(a, b uint8) int { if a == b { return 1 } return 0 } func TestConstantTimeByteEq(t *testing.T) { err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) if err != nil { t.Error(err) } } ͭͷؔ਺ʹ͍ͭͯಉ݁͡ՌΛฦ͢͜ͱ ςετର৅ ໌നͳ࣮૷ ಉ͡࢓༷ʢͷ͸ͣʣͷؔ਺Ͱ͋Ε͹ CheckEqualؔ਺ͰಉҰੑΛݕূͰ͖Δ ৽چͷΞϧΰϦζϜൺֱʹ΋࢖͑Δ

## Slide 53

### Slide 53 text

53 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ // A Block represents a PEM encoded structure. // // The encoded form is: // -----BEGIN Type----- // Headers // base64-encoded Bytes // -----END Type—— // where Headers is a possibly empty sequence of Key: Value lines. type Block struct { Type string Headers map[string]string Bytes []byte } // Encode writes the PEM encoding of b to out. func Encode(out io.Writer, b *Block) error { } ςετର৅

## Slide 54

### Slide 54 text

54 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ // A Block represents a PEM encoded structure. // // The encoded form is: // -----BEGIN Type----- // Headers // base64-encoded Bytes // -----END Type----- // where Headers is a possibly empty sequence of Key: Value lines. type Block struct { Type string Headers map[string]string Bytes []byte } // Encode writes the PEM encoding of b to out. func Encode(out io.Writer, b *Block) error { } 1&.ܗࣜͷσʔλߏ଄ ςετର৅

## Slide 55

### Slide 55 text

55 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ // A Block represents a PEM encoded structure. // // The encoded form is: // -----BEGIN Type----- // Headers // base64-encoded Bytes // -----END Type----- // where Headers is a possibly empty sequence of Key: Value lines. type Block struct { Type string Headers map[string]string Bytes []byte } // Encode writes the PEM encoding of b to out. func Encode(out io.Writer, b *Block) error { } Τϯίʔυ༻ͷؔ਺ ςετର৅

## Slide 56

### Slide 56 text

56 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ func TestFuzz(t *testing.T) { testRoundtrip := func(block Block) bool { var buf bytes.Buffer if err := Encode(&buf, &block); err != nil { t.Errorf("Encode of %#v resulted in error: %s", &block, err) return false } decoded, rest := Decode(buf.Bytes()) if !reflect.DeepEqual(decoded, &block) { t.Errorf("Encode of %#v decoded as %#v", &block, decoded) return false } return true } quick.Check(testRoundtrip, nil) } ςετίʔυ

## Slide 57

### Slide 57 text

57 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ func TestFuzz(t *testing.T) { testRoundtrip := func(block Block) bool { var buf bytes.Buffer if err := Encode(&buf, &block); err != nil { t.Errorf("Encode of %#v resulted in error: %s", &block, err) return false } decoded, rest := Decode(buf.Bytes()) if !reflect.DeepEqual(decoded, &block) { t.Errorf("Encode of %#v decoded as %#v", &block, decoded) return false } return true } quick.Check(testRoundtrip, nil) } ςετ༻ͷؔ਺ ςετίʔυ

## Slide 58

### Slide 58 text

58 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ func TestFuzz(t *testing.T) { testRoundtrip := func(block Block) bool { var buf bytes.Buffer if err := Encode(&buf, &block); err != nil { t.Errorf("Encode of %#v resulted in error: %s", &block, err) return false } decoded, rest := Decode(buf.Bytes()) if !reflect.DeepEqual(decoded, &block) { t.Errorf("Encode of %#v decoded as %#v", &block, decoded) return false } return true } quick.Check(testRoundtrip, nil) } ೚ҙͷσʔλͰΤϯίʔυʹࣦഊ͠ͳ͍͜ͱ ςετίʔυ

## Slide 59

### Slide 59 text

59 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ func TestFuzz(t *testing.T) { testRoundtrip := func(block Block) bool { var buf bytes.Buffer if err := Encode(&buf, &block); err != nil { t.Errorf("Encode of %#v resulted in error: %s", &block, err) return false } decoded, rest := Decode(buf.Bytes()) if !reflect.DeepEqual(decoded, &block) { t.Errorf("Encode of %#v decoded as %#v", &block, decoded) return false } return true } quick.Check(testRoundtrip, nil) } σίʔυͨ͠ΒݩͱҰக͢Δ͜ͱ Τϯίʔυɾσίʔυͨ݁͠Ռ ݩσʔλ ςετίʔυ

## Slide 60

### Slide 60 text

60 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. &ODPEFؔ਺ func TestFuzz(t *testing.T) { testRoundtrip := func(block Block) bool { var buf bytes.Buffer if err := Encode(&buf, &block); err != nil { t.Errorf("Encode of %#v resulted in error: %s", &block, err) return false } decoded, rest := Decode(buf.Bytes()) if !reflect.DeepEqual(decoded, &block) { t.Errorf("Encode of %#v decoded as %#v", &block, decoded) return false } return true } quick.Check(testRoundtrip, nil) } σίʔυͨ͠ΒݩͱҰக͢Δ͜ͱ Τϯίʔυɾσίʔυͨ݁͠Ռ ݩσʔλ ϥϯμϜͳೖྗ஋Ͱ΋ຬͨ͢΂͖ੑ࣭Λ ςετίʔυͱͯ͠هड़Ͱ͖Δ ࠓճ͸ ɾΤϥʔʹͳΒͳ͍͜ͱ ɾΤϯίʔυɾσίʔυͨ͠Βݩʹ໭Δ͜ͱ