量子能量塔

量子雖然連肉眼都看不見,但卻有著無限的能量。


  • 首頁

  • 歸檔

  • 標籤

  • 分類

  • 關於我

  • 聯動之術

  • COC7版

  • 模範合集

  • 補給站

  • 檢索

序列密码

發表於 2017-11-03 | 分類於 Cryptography | | 閱讀次數:
| 字數統計: 1,045

0x01 背景

序列密碼起源於20世紀20年代的維爾姆(Vernam)密碼。Vernam密碼中的密鑰序列要求是隨機的序列,由於密碼中的密鑰序列的產生、存儲以及分配等方面存在一定的困難,Vernam體制在當時並沒有得到廣泛的應用。然而,在微電子技術和數學理論逐漸變得完善後,序列密碼終於得到了長足的發展和應用。

目前,序列密碼是世界各國的軍事和外交等重要領域中使用的主要密碼體制之一。序列密碼是對稱密碼體制中的一類,又稱為流密碼。

0x02 原理

在序列密碼中,明文的每一個位會和密鑰序列的位相加來進行所謂的加密。而序列密碼共有2種:同步序列密碼和異步序列密碼。前者密碼序列取決於密鑰而後者則是密鑰和密文。

要對密文進行加密,我們需要將每一個位置的$x_i$與一個密鑰序列位$s_i$相加後再使用模數2來執行該運算。

定義

明文,密文和密鑰是由獨立的位組成,也可以寫成:$x_i,y_i,s_i∈{0,1}$
加密: $y_i= E s_i(x_i)\equiv x_i + s_i mod 2$
解密: $x_i= D s_i(y_i)\equiv y_i + s_i mod 2$

3個疑問要點

  • 為什麼加密和解密使用相同函數?
  • 為什麼可以使用簡單的Mod2加法進行加密?
  • 密鑰序列位$s_i$的本質是什麼?

為什麼加密和解密使用相同函數?

需證明:使用解密函數後,可得回明文位$x_i$。
已知:密文位$y_i$是通過加密函數$y_i\equiv x_i + s_i mod 2$計算得到。

把此加密表達式插入加密函數:
$d s_i\equiv y_i+s_i mod 2$
$\equiv (x_i + s_i)+s_i mod 2$
$x_i + s_i + s_i mod 2$
$x_i + 2s_i mod 2$
$x_i + 0 mod 2$
$x_i mod 2$
Q.E.D

表達式$2s_i mod 2$是0,因為$2\equiv 0 mod 2$。另外,若$s_i$的值為0,此時$2s_i = 2⋅0 \equiv 0 mod 2$。而$s_i$的值為1,此時$2s_i = 2⋅1 =2 \equiv 0 mod 2$。

為什麼可以使用簡單的Mod2加法進行加密?

首先,執行mod2算術運算時,得到的結果只能為0或者1。因此我們可以把mod2的算術運算看成Boolean。

$x_i$ $s_i$ $y_i\equiv x_i + s_i mod 2$
0 0 0
0 1 1
1 0 1
1 1 0

其结果和XOR的真值表是一样的。

我們來看一個實際例子:
A 的ASCII數值為65,轉成二進制為1000001。
假設密鑰序列的$s_i$開頭位是0101100。
經過加密後密文為1101101,換回字母是小寫的m。當然如果使用同樣的密鑰解密,那就可以得回明文為A。
也因為這樣所以便可以使用Mod2加法進行加密。

密鑰序列位$s_i$的本質是什麼?

根據以上例子,序列密碼的安全取決於密鑰序列。所以要使到攻擊者難以猜測,那麼序列密碼在加密時就必須使用隨機生成的密鑰序列。

而要生成隨機密鑰序列,可以使用接下來介紹的其中一種隨機數生成器。

0x03 隨機數生成器

現在讓我們來了解到底有哪些的隨機數生成器(RNGs)。

真隨機數生成器(TRNGs)

  • 輸出不可複制。
  • 多為基於物理過程。
  • 在密碼學中主要用作是生成會話密鑰。更詳細的用途以後會發文解釋清楚。

偽隨機數生成器(PRNGs)

從一個初始種子開始計算來得到序列。以下是其計算方式:
$s_0 = seed$
$s_{x+1}= f(s_i),i=0,1,$

這是其推廣形式,其中t為常數項。
$s_{i+1} = f(s_i,s_{i-1},\ldots s_{i-t})$

例子:線性同餘生成器
$s_0 = seed$
$s_{x + 1} \equiv a{s_i} + b mod m,i = 0,1,\ldots$

加密安全的偽隨機數生成器(CSPRNGs)

0x04 一次一密(One Time Pad)

資料來源

  • 《深入淺出密碼學——常用密碼技術原理與應用:第2章》
  • 《Crytography and network security principles and practice 》

ps:持續更新內容當中

2017 10月份Github 5大受歡迎的資安工具和目錄

發表於 2017-11-02 | 分類於 Tools | | 閱讀次數:
| 字數統計: 568
  • 文章來源:https://medium.com/hack-with-github/top-5-security-tools-october-2017-76ab31834efd

Hack with Github在Medium上發布了他們10月份中最受矚目的5大工具和目錄。而所發布的工具以及目錄如下:

Awesome Red Teaming

List of Awesome Red Team / Red Teaming Resources

This list is for anyone wishing to learn about Red Teaming but do not have a starting point.

Anyway, this is a living resources and will update regularly with latest Adversarial Tactics and Techniques.

You can help by sending Pull Requests to add more information.

Awesome Security

A list of Web Security materials and resources for learning the cutting edge penetrating technique.

Awesome Yara

A curated list of awesome YARA rules, tools, and resources.

Awesome Hacking

A collection of hacking and penetration testing resouces to make you better!

Deceptiveidn

Phishers are still using Internationalized Domain Names to trick users. This project uses computer vision to automatically check if IDNs have a deceptive reading.

3 大BlackHat Arsenal工具大放送

以下3個工具是在BlackHat arsenal裡面大放光芒,備受歡迎的。

2FAssassin

The tool exploits the common vulnerabilities that caused private keys leakage.

WHID Injector

WiFi HID Injector for Fun & Profit

CERTitude

CERTitude is a Python-based tool which aims at assessing the compromised perimeter during incident response assignments. It allows analysts to perform large scale scans of Windows-based information systems by searching for behavioural patterns described in IOC (Indicator Of Compromise) files.

Notable features:

  • Ability to scan hosts in a way that prevents the target workstation from knowing what the investigator is searching for
  • Ability to retrieve some pieces of data from the hosts
  • Multiple scanner instances (for IOCs and/or hash scans) can be run at the same time for parallel scanning
  • Built with security considerations in mind (protected database, secure communications with hosts using IPSec)

其他有趣的Tweet

想懂得更多的也可以看看哦。

PCI Express DIY hacking toolkit

This repository contains a set of tools and proof of concepts related to PCI-E bus and DMA attacks.

jSQL Injection automate tool

jSQL Injection is a Java application for automatic SQL database injection.

Radare2

r2 is a rewrite from scratch of radare in order to provide a set of libraries and tools to work with binary files.

Radare project started as a forensics tool, a scriptable commandline hexadecimal editor able to open disk files, but later support for analyzing binaries, disassembling code, debugging programs, attaching to remote gdb servers, ..

krackattacks-test-ap-ft

This script tests if APs are affected by CVE-2017-13082 (KRACK attack)

relative-url-extractor

During reconnaissance (recon) it is often helpful to get a quick overview of all the relative endpoints in a file. These days web applications have frontend pipelines that make it harder for humans to understand minified code. This tool contains a nifty regular expression to find and extract the relative URLs in such files. This can help surface new targets for security researchers to look at. It can also be used to periodically compare the results of the same file, to see which new endpoints have been deployed. History has shown that this is a goldmine for bug bounty hunters.

脫壳學習指南(UNPACK LEARNING GUIDE)

發表於 2017-11-01 | 分類於 Learning Guide | | 閱讀次數:
| 字數統計: 730

第一個步驟:學C語言

推薦課程

CS50- 學習電腦基本知識以及可以學習到C的編程技巧
Second Link: https://www.edx.org/course/introduction-computer-science-harvardx-cs50x

推薦書籍

C語言程序設計(The C Programming Language (2nd Edition), Brian W.Kernighan & Dennis M.Ritchie著)
C primer plus

閱讀全文 »
1…34
Milo

Milo

33 文章
19 分類
39 標籤
RSS
GitHub Twitter E-Mail Google FB Page Security and Digital Forensic Information
LINKS
  • 量子城
  • 洛林賢者無盡迷宮
  • 星塵物語
  • 破碎的失落空間
  • 卡特莱兹酒館
  • Dramatime
  • 小熊天藍星工具屋
  • 實用索引
  • 風鈴的世界
© 2017 — 2018 Milo | Site words total count: 39.0k
0%