blob: bbf775452e63fe57279796a05ba50837bcc089b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import qualified Data.ByteString.Char8 as BC
import Data.Torrent
import System.Environment
import System.Exit
checkInfo :: String
checkInfo = "0221caf96aa3cb94f0f58d458e78b0fc344ad8bf"
torrentFileName :: String
torrentFileName = "res/dapper-dvd-amd64.iso.torrent"
main :: IO ()
main = do
args <- getArgs
let path = if length args == 0 then torrentFileName else head args
t <- fromFile path
BC.putStr "info hash: "
print (ppInfoHash (tInfoHash t))
let passed = checkInfo == show (ppInfoHash (tInfoHash t))
print passed
if passed then exitSuccess else exitFailure
|