-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
33 lines (30 loc) · 787 Bytes
/
main.go
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
30
31
32
33
package main
import (
"fmt"
"os"
"sync"
"time"
"github.com/galuszkak/pesel/algorithm"
)
func main() {
channel := make(chan string)
wg := sync.WaitGroup{}
wg.Add(1)
if len(os.Args) != 2 {
fmt.Println("You need to provide path to PDF\nExample: go run main.go ./PIT.pdf ")
os.Exit(1)
}
filePath := os.Args[1]
// We are only interested in people older than 18 years
// So start date 2004/2/29
// Also we want to include people from 18 to 60 years = 42 years
// 365 days * 42years
startDate := time.Date(2004, time.February, 29, 0, 0, 0, 0, time.UTC)
allDays := 365 * 42
for i := 0; i < allDays; i++ {
go algorithm.GeneratePeselsForDate(startDate, channel)
go algorithm.DecryptPdf(filePath, channel, &wg)
startDate = startDate.AddDate(0, 0, -1)
}
wg.Wait()
}