#pragma once #include #include #include namespace NCodecs { template ui64 DataSignature(const T& t) { static_assert(!std::is_scalar::value, "no scalars"); return CityHash64(t.data(), t.size()); } template TString HexWriteScalar(T t) { static_assert(std::is_scalar::value, "scalars only"); t = LittleToBig(t); TString res = HexEncode(&t, sizeof(t)); res.to_lower(); return res; } template T HexReadScalar(TStringBuf s) { static_assert(std::is_scalar::value, "scalars only"); T t = 0; HexDecode(s.data(), Min(s.size(), sizeof(T)), &t); t = BigToLittle(t); return t; } }