# Pragyan CTF 2019 "The Order of the Phoenix" writeup
## Description
It's a new age Order of the Phoenix. The current members are:
1. Harry2. Hermione3. Ron4. George5. Charlie6. Bill7. Ginny8. Fleur9. Luna10. Neville
Each of them has a secret QR code associated with him/her which is given to you. At the entrance of the Grimmauld place, is a system to scan their QR codes.
Any 5 or more of them can enter at once, but not less than 5. This is in place to prevent any rash decisions made by very few people regarding the matters concerning the Order.
However, now is an emergency time. Malfoy is causing trouble again, and Harry needs to enter Grimmauld Place for which he needs to know the secret associated with the entry system to let him in. Help him out.
## Solution
10人がKeyを持っていて、5人集まれば情報が得られるという事から、シャミアの秘密分散法（Shamir's Secret Sharing）を使っているだろうと予想した。しばらくこれについて調べていると問題で与えられたのと同じ形式で秘密を分散させる [QR Secret Sharing](https://github.com/skewthreads/QR-secret-sharing) を見つけた。これの復号を実行するだけで良さそう。
また、事前に pyzbar で QRコードをまとめて読み取っておいた。
```pythonfrom PIL import Imagefrom pyzbar.pyzbar import decode
namelist = ['Harry', 'Hermione', 'Ron', 'George', 'Charlie', 'Bill', 'Ginny', 'Fleur', 'Luna', 'Neville']
for name in namelist:    qr = Image.open('{}.png'.format(name))    print(decode(qr)[0][0].decode())```
10個のKeyから5個のKeyを入力すると Flag が得られた。
![flag](flag.png "flag")
Flag : `pctf{sh4m1r3_w4s_4_gr34t_m4n}`