35 binary is designed to prevent visual errors caused by 0 and O
BEGIN
DECLARE m_strhex35 VARCHAR (100); --Returns the result of the 35 binary representation
DECLARE M_remainder BIGINT; --Remainder
DECLARE m_base35 VARCHAR (1);
SET m_remainder=0;
SET m_strhex35= ";
While p_hex10>=35 do
SET m_remainder=p_hex10%35;
SET p_hex10= (P_hex10-m_remainder)/35;
SET m_base35=substring (' 0123456789ABCDEFGHIJKLMNPQRSTUVWXYZ ', m_remainder+1,1);
SET M_strhex35=concat (m_base35,m_strhex35);
END while;
SET m_remainder=p_hex10%35;
SET m_base35=substring (' 0123456789ABCDEFGHIJKLMNPQRSTUVWXYZ ', m_remainder+1,1);
SET M_strhex35=concat (m_base35,m_strhex35);
--PRINT @StrHex35
RETURN m_strhex35;
END
BEGIN
DECLARE M_strhex35len INT; --The length of the 35 binary string being converted
DECLARE M_base35to10 INT; --10 binary data size per bit of 35 binary cardinality
DECLARE M_index INT; --String index
DECLARE m_hex10 BIGINT; --is returned 10 binary data
DECLARE m_base35 VARCHAR (1); --35 binary cardinality
DECLARE M_middle_data BIGINT;
SET m_hex10=0;
SET m_strhex35len=length (p_strhex35);
SET m_index=1;
while (M_index<=m_strhex35len) do
SET m_base35=substr (p_strhex35 from M_index for 1);
SET m_base35to10= LOCATE (m_base35, ' 0123456789ABCDEFGHIJKLMNPQRSTUVWXYZ ')-1;
--NOTE: You must first save the value of power to a variable, and the result cannot be calculated directly by a different variable, which will result in incorrect calculation results
SET m_middle_data = POWER (35,m_strhex35len-m_index);
SET M_hex10=m_hex10+m_base35to10 * M_MIDDLE_DATA;
SET m_index=m_index+1;
END while;
RETURN m_hex10;
END
Conversion between MySQL 10 binary and 35 binary note power handling bigint issues