룬 알고리즘
십진수 식별번호의 입력 오류를 검출하는 모듈로 10 검사 숫자 계산 방식
룬 알고리즘(Luhn algorithm)은 IBM 연구원 한스 페터 룬(Hans Peter Luhn)이 고안해 1954년 출원하고 1960년 등록한 미국 특허(US2950048A)에 기반한 검사 숫자 계산 방식이다. 오른쪽 두 번째 자리부터 번갈아 2배로 곱하고 두 자릿수 결과의 각 자릿수를 더한 전체 합이 10으로 나누어떨어지는지 확인한다. 결제카드 기본계좌번호(PAN), 휴대 단말 IMEI, 미국 의료제공자 식별번호(NPI) 등에 쓰이며 형식 적합성만 검증한다.
- 고안자
- 한스 페터 룬(Hans Peter Luhn)1
- 미국 특허
- US2950048A(1954-07-20 출원, 1960-08-23 등록)1
- 검증 원리
- 모듈로 10(Modulus 10) 교대 2배 합산5
- 주요 활용
- 결제카드 PAN, 단말 IMEI, 미국 NPI2
- NPI 적용 규칙
- 접두부 80840 반영(상수 24 가산)5
- 검증 한계
- 형식 오류 검출 전용(발급·활성 미보장)2
룬 알고리즘(Luhn algorithm)은 십진수 식별번호의 우발적 입력 오류를 검출하기 위해 끝에 검사 숫자(check digit)를 붙여 가중합이 10의 배수인지 확인하는 모듈로 10(Modulus 10) 검증 방식이다.
다른 이름 Luhn Algorithm, 룬 공식, 모듈로 10 검사
기원과 특허 연혁
룬 알고리즘은 한스 페터 룬이 고안한 번호 검증 방식으로, 미국 특허 US2950048A('Computer for Verifying Numbers')가 1954년 7월 20일 출원되어 1960년 8월 23일 공개·등록됐다.1 계산이 단순하고 구현 비용이 낮아 금융, 이동통신, 보건 행정 분야의 표준 검사 숫자(check digit) 규칙으로 널리 자리 잡았다.145
- 1US2950048A: Computer for Verifying Numbers (Hans Peter Luhn)Google Patents (USPTO) ↗
- 4ETSI TS 123 003 V18.7.0 (Annex B: IMEI Check Digit)European Telecommunications Standards Institute (ETSI) ↗
- 5NPI Check Digit Technical SpecificationCenters for Medicare & Medicaid Services (CMS) ↗
모듈로 10 계산 절차
검사 숫자가 포함된 십진수 문자열을 검증할 때는 오른쪽 끝에서 두 번째 자리부터 왼쪽으로 가며 한 칸씩 건너뛴 숫자를 2배로 계산한다. 2배 결과가 두 자릿수(10~18)이면 각 자릿수를 합산한다(9를 빼는 것과 동일하다).156
- 1US2950048A: Computer for Verifying Numbers (Hans Peter Luhn)Google Patents (USPTO) ↗
- 5NPI Check Digit Technical SpecificationCenters for Medicare & Medicaid Services (CMS) ↗
- 6LuhnCheckDigit API Documentation (Apache Commons Validator 1.11.0)Apache Software Foundation ↗
이렇게 구한 값과 2배 하지 않은 나머지 자릿수를 모두 더한 합계를 10으로 나누었을 때 나머지가 0이면 검사에 통과한다.56 새 검사 숫자를 생성할 때는 본체 맨 오른쪽 자리부터 교대 2배를 적용한 뒤, 총합을 다음 10의 배수로 맞추는 숫자를 끝에 붙인다.5
- 5NPI Check Digit Technical SpecificationCenters for Medicare & Medicaid Services (CMS) ↗
- 6LuhnCheckDigit API Documentation (Apache Commons Validator 1.11.0)Apache Software Foundation ↗
주요 활용 분야: 결제카드 PAN·IMEI·미국 NPI
룬 알고리즘은 여러 국제·국가 식별번호 표준에 채택되어 있다.
¶- 결제카드 기본계좌번호(PAN): 결제 시스템이 승인 요청 전 카드번호 오타를 1차로 걸러내는 데 사용한다.2
- 휴대 단말 IMEI: GSMA 제조사 가이드와 유럽전기통신표준화기구(ETSI) TS 123 003 부속서 B는 단말 고유식별번호(IMEI)의 마지막 검사 숫자 계산에 룬 공식을 규정한다.34
- 미국 의료제공자 식별번호(NPI): 미국 메디케어·메디케이드 서비스센터(CMS) 명세에 따르면 10자리 NPI는 의료·미국 코드인 접두부
80840이 붙은 것으로 간주해 룬 검사를 수행하며, 접두부 없이 10자리만 검증할 때는 2단계 합계에 상수 24를 더한다.5
- 2PCI SSC FAQ 1137: Account Number Validation and Issuance StatusPCI Security Standards Council ↗
- 3IMEI Database Device Manufacturers User Guide (Version 4.0)GSMA ↗
- 4ETSI TS 123 003 V18.7.0 (Annex B: IMEI Check Digit)European Telecommunications Standards Institute (ETSI) ↗
- 5NPI Check Digit Technical SpecificationCenters for Medicare & Medicaid Services (CMS) ↗
검출 한계와 형식·발급 상태의 구분
룬 알고리즘은 단일 자릿수 오타와 대부분의 인접 두 자리 뒤바뀜(단, 09와 90 교환 제외)을 잡아내지만, 암호학적 해시가 아니므로 의도적인 번호 위조를 막지는 못한다.16
- 1US2950048A: Computer for Verifying Numbers (Hans Peter Luhn)Google Patents (USPTO) ↗
- 6LuhnCheckDigit API Documentation (Apache Commons Validator 1.11.0)Apache Software Foundation ↗
특히 PCI 보안표준위원회(PCI SSC FAQ 1137)가 명시하듯, 룬 검사를 통과하더라도 이는 번호 형식이 규칙에 맞음을 뜻할 뿐 실제 카드 발급 여부나 활성 계좌 상태를 보장하지 않는다.2 한편 유료 표준인 ISO/IEC 7812-1 전문은 직접 열람하지 않았으며, 본 문서는 미국 특허·PCI SSC·GSMA·ETSI·CMS·Apache 공식 문서를 근거로 작성했다.1245
- 2PCI SSC FAQ 1137: Account Number Validation and Issuance StatusPCI Security Standards Council ↗
- 1US2950048A: Computer for Verifying Numbers (Hans Peter Luhn)Google Patents (USPTO) ↗
- 4ETSI TS 123 003 V18.7.0 (Annex B: IMEI Check Digit)European Telecommunications Standards Institute (ETSI) ↗
- 5NPI Check Digit Technical SpecificationCenters for Medicare & Medicaid Services (CMS) ↗
자주 묻는 질문
인용 문장
연표
출처
정부·공공 기록
- 5NPI Check Digit Technical Specification · Centers for Medicare & Medicaid Services (CMS) · 게시일 2004-01-23 · 확인일 2026-12-04https://www.cms.gov/Regulations-and-Guidance/Administrative-Simplification/NationalProvIdentStand/Downloads/NPIcheckdigit.pdf
학술·언론
- 1US2950048A: Computer for Verifying Numbers (Hans Peter Luhn) · Google Patents (USPTO) · 게시일 1960-08-23 · 확인일 2026-12-04https://patents.google.com/patent/US2950048A/en
- 2PCI SSC FAQ 1137: Account Number Validation and Issuance Status · PCI Security Standards Council · 게시일 2012-07-01 · 확인일 2026-12-04https://www.pcisecuritystandards.org/faqs/1137/
- 3IMEI Database Device Manufacturers User Guide (Version 4.0) · GSMA · 게시일 2015-09-01 · 확인일 2026-12-04https://imeidb.gsma.com/imei/resources/documents/IMEIDB_IA_UserGuide.pdf
- 4ETSI TS 123 003 V18.7.0 (Annex B: IMEI Check Digit) · European Telecommunications Standards Institute (ETSI) · 게시일 2024-09-01 · 확인일 2026-12-04https://www.etsi.org/deliver/etsi_ts/123000_123099/123003/18.07.00_60/ts_123003v180700p.pdf
- 6LuhnCheckDigit API Documentation (Apache Commons Validator 1.11.0) · Apache Software Foundation · 게시일 2026-01-01 · 확인일 2026-12-04https://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/checkdigit/LuhnCheckDigit.html
검토와 작성 정보
전문가 검토를 기다리고 있습니다
자격이 확인된 전문가가 이 문서를 검토하면 이름과 검토 날짜가 여기에 표시됩니다. (현재 버전 3b47a729)
문서 작성 방법
위 출처에 있는 공개 자료를 바탕으로 자동 작성했습니다.
버전
3b47a7291b65b5c0d1aeff1eded949547c46c5a790a4de7c5e32723abc4345ec
문서를 수정할 때마다 새 버전 번호가 붙습니다.
Mimirwiki. "룬 알고리즘." 버전 3b47a729, 2026-12-04. https://mimirwiki.com/ko/wiki/luhn-algorithm
# Markdown curl https://mimirwiki.com/ko/wiki/luhn-algorithm.md # JSON-LD, by content negotiation curl -H "Accept: application/ld+json" \ https://mimirwiki.com/ko/wiki/luhn-algorithm
주소 끝에 확장자를 붙이면 같은 내용을 해당 형식으로 받을 수 있습니다.