Why do seemingly empty files and strings produce md5sums?

后端 未结 3 2050
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 07:56

Consider the following:

% md5sum /dev/null
d41d8cd98f00b204e9800998ecf8427e  /dev/null
% touch empty; md5sum empty
d41d8cd98f00b204e9800998ecf8427e  empty
% echo         


        
3条回答
  •  忘掉有多难
    2021-01-31 08:13

    No need for surprise. The first two produce true empty inputs to md5sum. The echo produces a newline (echo -n '' should produce an empty output; I don't have a linux machine here to check). The perl produces a single zero byte (not to be confused with C where a zero byte marks end of string). The last command is looking for a file with the empty string as its file name.

提交回复
热议问题