To encrypt: Suppose the plaintext
has N characters.
Then
compute the decimal expansion of sqrt(N)-M, and add successive digits after the decimal point, mod 27, to the characters of the plaintext, taking space as 0 and A-Z as 1-26. (Ignore digits before the decimal point; equivalently, take the fractional part. To be absolutely explicit, we are writing frac(sqrt(N)) in base 10, not base 27, though the latter would have obvious advantages.) Capitalize letters that were at the starts of words in the plaintext.
So, for instance, let's decrypt LhFnfXpegTpewtiswaUtlbfrdNwjv as requested.
This has 29 characters. The fractional part of sqrt(29) is about .3851648071345040312507104915403295562951201616. So shift the letters back by those amounts; we get
I AM THE SMARTEST SOLUER EVERwhich appears to have a single off-by-one error in it.
And let's encrypt I know how to encode this phrase.
This has 32 characters. Fractional part of sqrt(32) is about .656854249492380195206754896838792314278687501507792. We get
OeQvtabLxaiVrhEoltfefAmmaiVpui n.
Exercise for the reader: what do you get when you "encrypt" This is annoying?