To answer your first question: your understanding of the extension operation is more or less correct. But you have 2 problems:
- You misinterpret what you copied here.
- You cannot calculate hashes like you do on the shell
, , Linux IMA.
template-hash
template-hash: SHA1(filedata-hash | filename-hint)
filedata-hash: SHA1(filedata)
, : SHA1(0ea26e75253dc2fda7e4210980537d035e2fb9f8 | "boot_aggregate")
1ca03ef9cca98b0a04e5b01dabe1ff825ff0280a.
, - 256- - 0-padded.
( ;))
, : PCR.
- Ruby, :
require 'digest/sha1'
filedata_hash = ["0ea26e75253dc2fda7e4210980537d035e2fb9f8"].pack('H*')
filename_hint = "boot_aggregate".ljust(256, "\x00")
puts Digest::SHA1.hexdigest(filedata_hash + filename_hint)
:
, ASCII.
, .
1ca03ef9cca98b0a04e5b01dabe1ff825ff0280a
160- - - SHA1. ,
SHA1
320 .
,
printf "\x1c\xa0\x3e\xf9\xcc\xa9\x8b\x0a\x04\xe5\xb0\x1d\xab\xe1\xff\x82\x5f\xf0\x28\x0a\x0e\xa2\x6e\x75\x25\x3d\xc2\xfd\xa7\xe4\x21\x09\x80\x53\x7d\x03\x5e\x2f\xb9\xf8" | sha1sum
\xXX printf XX
.
d14f958b2804cc930f2f5226494bd60ee5174cfa,
.