LibCrypto: Convert StringBuilder::appendf() => AK::Format

This commit is contained in:
Andreas Kling 2021-05-07 11:42:33 +02:00
parent c2a8869c1f
commit e76956f712
Notes: sideshowbarker 2024-07-18 18:35:42 +09:00
2 changed files with 9 additions and 13 deletions

View file

@ -26,8 +26,8 @@ constexpr void swap_keys(u32* keys, size_t i, size_t j)
String AESCipherBlock::to_string() const
{
StringBuilder builder;
for (size_t i = 0; i < BlockSizeInBits / 8; ++i)
builder.appendf("%02x", m_data[i]);
for (auto value : m_data)
builder.appendff("{:02x}", value);
return builder.build();
}
@ -35,7 +35,7 @@ String AESCipherKey::to_string() const
{
StringBuilder builder;
for (size_t i = 0; i < (rounds() + 1) * 4; ++i)
builder.appendf("%02x", m_rd_keys[i]);
builder.appendff("{:02x}", m_rd_keys[i]);
return builder.build();
}

View file

@ -100,11 +100,9 @@ public:
virtual String class_name() const override
{
StringBuilder builder;
builder.append("SHA");
builder.appendf("%zu", this->DigestSize * 8);
return builder.build();
};
return String::formatted("SHA{}", DigestSize * 8);
}
inline virtual void reset() override
{
m_data_length = 0;
@ -152,11 +150,9 @@ public:
virtual String class_name() const override
{
StringBuilder builder;
builder.append("SHA");
builder.appendf("%zu", this->DigestSize * 8);
return builder.build();
};
return String::formatted("SHA{%zu}", DigestSize * 8);
}
inline virtual void reset() override
{
m_data_length = 0;