bcrypt블로피시 암호에 기반을 둔 암호화 해시 함수로서 Niels Provos와 David Mazières가 설계하였으며 1999년 USENIX에서 발표되었다.[1] 레인보 테이블 공격 방지를 위해 솔트를 통합한 bcrypt는 적응형 함수의 하나이다. 시간이 지남에 따라 속도 저하를 위해 반복 횟수가 증가가 수반될 수 있으므로 연산 파워의 증가에도 브루트 포스 검색 공격에 대한 저항을 유지하게 된다.

bcrypt
일반
설계자Niels Provos, David Mazières
최초 출판일1999
기원블로피시
상세 정보
다이제스트 크기184비트
라운드 수비용 변수에 따라 가변적

bcrypt 함수는 OpenBSD[2]수세 리눅스 등의 일부 리눅스 배포판을 포함한 기타 시스템용 기본 암호 해시 함수이다.[3]

C, C++, C#, Elixir,[4] Go,[5] Java,[6][7] 자바스크립트,[8] , PHP, 파이썬,[9] Ruby 등의 언어용으로 bcrypt 구현체가 존재한다.

개요 편집

bcrypt 해시 문자열은 다음의 형태에 속한다:

$2b$[cost]$[22 character salt][31 character hash]

예:

$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy
 \/ \/ \____________________/\_____________________________/
Alg Cost       Salt                        Hash

여기서

  • 2a: 해시 알고리즘 식별자 (bcrypt)
  • 10: Cost factor (210 ==> 1,024 rounds)
  • N9qo8uLOickgx2ZMRZoMye: 16바이트(128비트) 솔트, base64-encoded to 22 characters
  • IjZAgcfl7p92ldGxad68LJZdL17lhWy: 24바이트(192비트) 해시, base64-encoded to 31 characters

알고리즘 편집

Function bcrypt
   Input:
      cost:     Number (4..31)                      log2(Iterations). e.g. 12 ==> 212 = 4,096 iterations
      salt:     array of Bytes (16 bytes)           random salt
      password: array of Bytes (1..72 bytes)        UTF-8 encoded password
   Output:
      hash:     array of Bytes (24 bytes)
   //Initialize Blowfish state with expensive key setup algorithm
   //P: array of 18 subkeys (UInt32[18])
   //S: Four substitution boxes (S-boxes), S0...S3. Each S-box is 1,024 bytes (UInt32[256])
   P, S ← EksBlowfishSetup(cost, salt, password)
   //Repeatedly encrypt the text "OrpheanBeholderScryDoubt" 64 times
   ctext"OrpheanBeholderScryDoubt"  //24 bytes ==> three 64-bit blocks
   repeat (64)
      ctext ← EncryptECB(P, S, ctext) //encrypt using standard Blowfish in ECB mode
   //24-byte ctext is resulting password hash
   return Concatenate(cost, salt, ctext)

같이 보기 편집

각주 편집

  1. Provos, Niels; Mazières, David; Talan Jason Sutton 2012 (1999). “A Future-Adaptable Password Scheme”. 《Proceedings of 1999 USENIX Annual Technical Conference》: 81–92. 
  2. “Commit of first work to repo”. 1997년 2월 13일. 
  3. “SUSE Security Announcement: (SUSE-SA:2011:035)”. 2011년 8월 23일. 2016년 3월 4일에 원본 문서에서 보존된 문서. 2015년 8월 20일에 확인함. SUSE's crypt() implementation supports the blowfish password hashing function (id $2a) and system logins by default also use this method. 
  4. Whitlock, David. “Bcrypt Elixir: bcrypt password hashing algorithm for Elixir.”. 《GitHub》. riverrun. 
  5. “Package bcrypt”. 《godoc.org》. 
  6. “jBCrypt - strong password hashing for Java”. 《www.mindrot.org》 (영어). 2017년 3월 11일에 확인함. 
  7. “bcrypt - A Java standalone implementation of the bcrypt password hash function”. 《github.com》 (영어). 2018년 7월 19일에 확인함. 
  8. “bcryptjs”. 《npm》. 
  9. Stufft, Donald. “bcrypt: Modern password hashing for your software and your servers” – PyPI 경유. 

외부 링크 편집