This is directly adapted from the recent discoveries in integer factoring.
And neither of those algorithms are in P.