/homework-cryptography

homework on courser cryptography

Primary LanguageJavaScriptMIT LicenseMIT

cryptography-homework

Coursera 的密碼學課程功課。

僅供參考。

目錄

課程歷程

  • Many Time Attack - 2020-10-22
  • Hashing Videos - 2020-12-07
  • Padding Oracle Attack - 2020-12-14
  • Meet In Middle Attack in RSA - 2020-12-21
  • Close Factor Attack in RSA - 2020-12-29

安裝

$ npm install

使用方法

下載該有的檔案,然後執行下列程式碼。

# many time attack on one time padding
$ npm run many-time-attack
# hashing video
$ npm run hash-video
# padding oracle attack
$ npm run padding-oracle-attack
# meet in middle in RSA
$ npm run rsa-meet-in-middle-attack
# close factor in RSA
$ npm run rsa-close-factor-attack
# test all
$ npm run test
# test playground, do whatever you want!
$ npm run playground

下載或建立測試檔案

Many Time Attack

  • data.json : object with train, test

Example:

{
  "train": ["123", "456"],
  "test": ["789"]
}

Hashing Videos

Example:

{
  "test": {
    "video": "test.mp4"
  },
  "check": {
    "video": "check.mp4",
    "tag": "123"
  }
}

Padding Oracle Attack

  • data.json : object with url, path, queryKey, cypher, decrypted (optional)

Example:

{
  "url": "http://crypto-class.appspot.com",
  "path": "/po",
  "queryKey": "er",
  "cypher": "f20bdba6ff29eed7b046d1df9fb7000058b1ffb4210a580f748b4ac714c001bd"
}

Meet In Middle Attack in RSA

  • data.json : object with g, h, p, keySize

Example:

{
  "g": "2",
  "h": "7",
  "p": "13",
  "keySize": 4
}

Close Factor in RSA

  • data.json : array of object with N, bound

Example:

[
  {
    "N": "323",
    "bound": 1
  },
  {
    "N": "232166152",
    "bound": [1, 100]
  },
  {
    "N": "622288097498926496141095869268883999563096063592498055290461",
    "3p+2q": true
  }
]

授權

請看 LICENSE

TODO

  • Multi threads: workerpool
  • Python