Provided by: manpages-ko-dev_4.27.0-1_all bug

이름

       memcmp - 메모리 영역 비교하기

라이브러리

       표준 C 라이브러리 (libc, -lc)

요약

       #include <string.h>

       int memcmp(const void s1[.n], const void s2[.n], size_t n);

설명

       The  memcmp()   function  compares  the  first n bytes (each interpreted as unsigned char)  of the memory
       areas s1 and s2.

반환값

       memcmp() 함수는 s1의 처음 n 바이트가 s2의 처음 n 바이트보다 작거나 같거나 크다면, 각각 0보다  작은  정수,
       0, 0보다 큰 정수를 반환한다.

       For  a  nonzero return value, the sign is determined by the sign of the difference between the first pair
       of bytes (interpreted as unsigned char) that differ in s1 and s2.

       If n is zero, the return value is zero.

속성

       이 섹션에서 사용되는 용어에 대한 설명은 attributes(7)을 참조하십시오.
       ┌─────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
       │ 상호 작용속성번호    │
       ├─────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
       │ memcmp()                                                                    │ Thread safety │ MT-Safe │
       └─────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘

표준

       C11, POSIX.1-2008.

이력

       POSIX.1-2001, C89, SVr4, 4.3BSD.

CAVEATS

       Do not use memcmp()  to compare confidential data, such as cryptographic secrets, because  the  CPU  time
       required  for  the comparison depends on the contents of the addresses compared, this function is subject
       to  timing-based  side-channel  attacks.   In  such  cases,  a  function  that  performs  comparisons  in
       deterministic  time,  depending  only on n (the quantity of bytes compared)  is required.  Some operating
       systems provide such a function (e.g., NetBSD's consttime_memequal()), but no such function is  specified
       in POSIX.  On Linux, you may need to implement such a function yourself.

추가 참조

       bstring(3), strcasecmp(3), strcmp(3), strcoll(3), strncasecmp(3), strncmp(3), wmemcmp(3)

번역

       이 매뉴얼 페이지의 한국어 번역은 다음에 의해 편집되었습니다: 정강훈 <skyeyes@soback.kornet.net>

       이  번역은  무료  문서입니다. 저작권 조건에 대해서는 GNU General Public License 버전 3 이상을 읽으십시오.
       책임이 없습니다.

       이  매뉴얼  페이지의  번역에서   오류를   발견하면   translation-team-ko@googlegroups.com   로   이메일을
       보내주십시오.

Linux man-pages 6.9.1                            2024년 5월 2일                                        memcmp(3)