You can use the property of square sum decomposition: (a+b)^2 = a^2+2ab+b^2.I only know the algorithm for doing this by hand in a decimal base, but it shouldn't be too hard to implement in software using binary base.

1) split the input number by groups of two digits starting at the decimal point. (e.g. 324 will become 3 and 24, lets call them X and Y. )2) find a digit, square of which will be less or equal to X. let's call this number Z (=1) 3) subtract it from the X (now X = 2) 4) combine the result with the remaining digit pair Y. (we got 224)5) do 2Z^2 (=2) 6) find a number which if combined with the result of previous step and multiplied by itself will yield result smaller/equal to the result of 4th step. (in this case it's 8. i.e. 28*8 = 224 => 224 = 224. ) 7) repeat the algorithm. (in this example we got a result already, so no need to repeat anything. square root of 324 is 18.)

So in this particular case: a=10*1 and b=8. And indeed: (2*1*10+8)*8=2*1*10*8+8^2 conforms with 2ab+b^2.