<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Конвертация из Base64 в Base10]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=14921</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14921&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Конвертация из Base64 в Base10».]]></description>
		<lastBuildDate>Thu, 15 Aug 2019 17:25:05 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Конвертация из Base64 в Base10]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=135627#p135627</link>
			<description><![CDATA[<p>Оказывается, нужны первые 11 символов). Респект!</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Thu, 15 Aug 2019 17:25:05 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=135627#p135627</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация из Base64 в Base10]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=135623#p135623</link>
			<description><![CDATA[<p>Без понятия.<br />Такой вывод получается если взять первую часть от шорткода - BiOiu_BDEuf.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Thu, 15 Aug 2019 16:51:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=135623#p135623</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация из Base64 в Base10]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=135621#p135621</link>
			<description><![CDATA[<p>А с чем связано, что длинные шорткоды из закрытых групп неточно конвертируются? К примеру, этот шорткод — <br /></p><div class="codebox"><pre><code>
BiOiu_BDEufpHY4lHlEizHKHvv9X8cHIpaj3Ks0
</code></pre></div><p>должен соответствовать этому медиаИд — <br /></p><div class="codebox"><pre><code>
1769504465943808927
</code></pre></div><p>однако вывод другой получается.</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Thu, 15 Aug 2019 13:21:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=135621#p135621</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация из Base64 в Base10]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=135573#p135573</link>
			<description><![CDATA[<p>Замените:<br /></p><div class="codebox"><pre><code>static coeffMap:=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&quot;</code></pre></div><p>на:<br /></p><div class="codebox"><pre><code>static coeffMap:=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 13 Aug 2019 23:58:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=135573#p135573</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Конвертация из Base64 в Base10]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=135571#p135571</link>
			<description><![CDATA[<p>Как правильно переконвертировать &quot;Y7GF-5vftL&quot; — в &quot;448979387270691659&quot; (инстаграмные shortcode и mediaId)? Код ниже в обе стороны конвертирует неточно.</p><div class="codebox"><pre><code>msgbox % base64to10(&quot;Y7GF-5vftL&quot;)

; https://www.autohotkey.com/boards/viewtopic.php?f=76&amp;t=37465
base64to10(b64){
	; Input:
	; 	b64, a string of totalNumberOfCoefficients polynomial coefficients representing a number in base64
	; Output:
	;	b10, the integer represented by b64 in base10.
	;
	; coefficient mapping:	
	;						A -&gt;  0
	;						B -&gt;  1
	;						 ...
	;						/ -&gt; 63
	static coeffMap:=&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&quot;
	local theCurrentCoefficientInBase64, theCurrentCoefficientMappedToBase10, totalNumberOfCoefficients, b10
	totalNumberOfCoefficients := strlen(b64)							; The number of coefficients in b64 
	b10:=0																; The output
	arrayOfTheBase64Coefficients:=strsplit(b64)
	for theNumberOfTheCurrentCoefficient, theCurrentCoefficientInBase64 in arrayOfTheBase64Coefficients	{					; Visit each coefficient in b64
		theCurrentCoefficientMappedToBase10 := instr(coeffMap, theCurrentCoefficientInBase64, caseSensitive:=true) - 1		; - 1 due to 1-based index of string position.
		b10 += 64**(totalNumberOfCoefficients-theNumberOfTheCurrentCoefficient)*theCurrentCoefficientMappedToBase10			; Increment the sum
	}
	return b10													; Done
}
base10to64(b10) {
	; Input:
	; 	b10, an integer in base10 to be converted to a string of polynomial coefficients
	;		 representing the same number in base64.
	; Output:
	;	b64, a string of n polynomial coefficients, cn-1,...,c0,
	;		 such that b10 = cn-1*64**(n-1)+cn-2*64**(n-2)...+c0*64**0
	static coeffMap := &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&quot;
	local b64 := SubStr(coeffMap, (b10 &amp; 63) + 1, 1)
   	b10 &gt;&gt;= 6											; b10 &gt;&gt;= 6 is  b10 /= 64
   	b10 &amp;= 0x03FFFFFFFFFFFFFF
   	While (b10) {
		b64 := SubStr(coeffMap, (b10 &amp; 63) + 1, 1) . b64	; (b10 &amp; 63) is mod(b10,64)
		b10 &gt;&gt;= 6											; b10 &gt;&gt;= 6 is  b10 /= 64
	}
	return b64
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 13 Aug 2019 23:29:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=135571#p135571</guid>
		</item>
	</channel>
</rss>
