လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> ဖန်ရှင်အမျိုးအစားများ> sha1_file

sha1_file

ဖိုင်၏ sha1 hash တန်ဖိုးကိုတွက်ချက်ပါ
အမည်:sha1_file
အမျိုးအစား:ကြိုး
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:ဖိုင်၏ Sha-1 hash တွက်ချက်။

အဓိပ္ပါယ်နှင့်အသုံးပြုမှု

sha1_file() function သည် function ကို file ၏ Sha-1 hash ကိုတွက်ချက်သည်။

sha1_file() function သည်အမေရိကန်လုံခြုံ hash algorithm ကိုအသုံးပြုသည်။

RFC 3174 - US Secure Hash Algorithm 1: SHA-1 သည် Message Digest ဟုခေါ်သော 160-bit output ကိုထုတ်လုပ်သည်။ မက်ဆေ့ခ်ျအစာကြေငြာချက်သည် message signature ကိုထုတ်လုပ်နိုင်သည့်သို့မဟုတ်အတည်ပြုနိုင်သည့်လက်မှတ် algorithm သို့ input ကိုထည့်သွင်းနိုင်သည်။ မက်ဆေ့ခ်ျကိုလက်မှတ်ရေးထိုးမည့်အစားအစာကြေမယ့်အစားမက်ဆေ့ခ်ျကိုလက်မှတ်ရေးထိုးမည့်အစားလုပ်ငန်းစဉ်ထိရောက်မှုကိုတိုးတက်စေနိုင်သည်။ ဒီဂျစ်တယ်လက်မှတ်၏အတည်ပြုသူသည်ဒစ်ဂျစ်တယ်လက်မှတ်၏ဖန်ဆင်းရှင်အဖြစ်အလားတူ Hashing algorithm ကိုအသုံးပြုရမည်။

အောင်မြင်လျှင်တွက်ချက် shi-1 hash ကိုပြန်ပို့ပါ

နမူနာ

ဥပမာ 1

"test.txt" စာသားဖိုင်၏ sha-1 hash ကိုတွက်ချက်:

 <? PHP
$ filename = "test.txt" ;
$ sha1file = sha1_file ( $ filename ) ;
ECHO $ ​​Sha1File ;
>

အထက်ပါကုဒ် output ကို:

 AAF4C61DDCCCCCCCCENE8DACBEY0F3B482CD9434D

ဥပမာ 2

ဖိုင်တွင် "test.txt" ၏ Sha-1 hash ကိုသိုလှောင်ခြင်း -

 <? PHP
$ sha1file = sha1_file ( "test.txt" ) ;
File_Propl_Contents ( "Sha1file.txt" , $ sha1file ) ;
>

"Test.txt" ကိုပြုပြင်မွမ်းမံခြင်းရှိမရှိစစ်ဆေးပါ (i.e. )

 <? PHP
$ sha1file = file_get_contents ( "sha1file.txt" ) ;
အကယ်. ( sha1_file ( "test.txt" ) == $ sha1file )
  {
  ECHO "ဖိုင်ကအဆင်ပြေပါတယ်။ " ;
  }
သို့မဟုတ်
  {
  ECHO "ဖိုင်ကိုပြောင်းထားသည်။ " ;
  }
>

အထက်ပါကုဒ် output ကို:

 ဖိုင်ကအဆင်ပြေပါတယ်

သဒ္ဒါ

 sha1_file ( ဖိုင် , ကုန်ကြမ်း )
တေးရေး ဖေါ်ပြ
ဖိုင်တဲှ လိုအပ်ပါတယ် တွက်ချက်ခံရဖို့စာရွက်စာတမ်းများကိုသတ်မှတ်ပါ။
မပြုပြင်ရသေးသော

optional ကို။ Boolean Value, hexadecimal သို့မဟုတ် binary output profast ကိုသတ်မှတ်ခြင်း -

  • မှန်ကန်သော - မူရင်း 20 - ဇာတ်ကောင် binary format
  • အတု - ပုံမှန်။ အက်ခရာ 40 hexadecimal နံပါတ်
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • တစ်ခုထွက်ပြေးလွတ်မြောက် string ကိုထုတ်ဖော်ပြသခဲ့သည် stripslashes

    stripslashes

    တစ်ခုထွက်ပြေးလွတ်မြေ
  • စာလုံးအသေးကိုပထမ ဦး ဆုံးဇာတ်ကောင်ကိုသတ်မှတ်ပါ lcfirst

    lcfirst

    စာလုံးအသေးကိုပထမဦးဆု
  • string ၏အဆုံးမှာ whitespace ဇာတ်ကောင် (သို့မဟုတ်အခြားဇာတ်ကောင်) ကိုဖျက်ပါ rtrim

    rtrim

    string၏အဆုံးမှာwhite
  • သေးငယ်တဲ့တုံးသို့ string ကိုခွဲ chunk_split

    chunk_split

    သေးငယ်တဲ့တုံးသို့str
  • binary လုံခြုံတဲ့ string ကိုနှိုင်းယှဉ် strcmp

    strcmp

    binaryလုံခြုံတဲ့stri
  • နှစ်ခု strings အကြားတူညီတွက်ချက် similar_text

    similar_text

    နှစ်ခုstringsအကြားတူ
  • အရှည်အတွက် string ကိုဖြည့်ရန်အခြား string ကိုသုံးပါ str_pad

    str_pad

    အရှည်အတွက်stringကိုဖ
  • output ကို format ချ string ကို vprintf

    vprintf

    outputကိုformatချstr
လူကြိုက်များသော ဆောင်းပါးများ