<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: SHA-1 and HMAC-SHA1 Routines in Pure Lua</title>
	<atom:link href="http://regex.info/blog/lua/sha1/feed" rel="self" type="application/rss+xml" />
	<link>http://regex.info/blog</link>
	<description>Not a photo blog. A personal blog with photos.</description>
	<lastBuildDate>Wed, 23 May 2012 20:38:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: kdoi</title>
		<link>http://regex.info/blog/lua/sha1#comment-43911</link>
		<dc:creator>kdoi</dc:creator>
		<pubDate>Fri, 26 Aug 2011 18:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-43911</guid>
		<description>Hi Jeffrey,

Thank you for the code. Yamaha sells many routers in Japan and has top share for smaller business. The Yamaha routers has Lua scripting feature to control the configurations such as routing. Your script was quite useful when I implemented a script that hits AWS (Amazon Web Services) APIs on Yamaha routers.

Thanks!
Doi, Koichiro</description>
		<content:encoded><![CDATA[<p>Hi Jeffrey,</p>
<p>Thank you for the code. Yamaha sells many routers in Japan and has top share for smaller business. The Yamaha routers has Lua scripting feature to control the configurations such as routing. Your script was quite useful when I implemented a script that hits AWS (Amazon Web Services) APIs on Yamaha routers.</p>
<p>Thanks!<br />
Doi, Koichiro</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Snyder</title>
		<link>http://regex.info/blog/lua/sha1#comment-42937</link>
		<dc:creator>James Snyder</dc:creator>
		<pubDate>Thu, 05 May 2011 09:24:33 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-42937</guid>
		<description>As a side note, related to an earlier comment, as far as I can tell, Mark Hamburg has returned to Adobe as of about a month after the comment referring to him having left Adobe &quot;a long time ago.&quot; Here&#039;s a current link to &lt;a href=&quot;http://www.linkedin.com/profile/view?id=10387226&amp;authType=name&amp;authToken=nfvt&amp;locale=en_US&amp;pvs=pp&amp;trk=ppro_viewmore&quot; rel=&quot;nofollow&quot;&gt;his LinkedIn&lt;/a&gt;.  This needn&#039;t be a separate comment, but whatever. Here&#039;s John Nack&#039;s &lt;a href=&quot;http://blogs.adobe.com/jnack/2009/07/mark_hamburg_returns_to_adobe.html&quot; rel=&quot;nofollow&quot;&gt;post&lt;/a&gt; on it.</description>
		<content:encoded><![CDATA[<p>As a side note, related to an earlier comment, as far as I can tell, Mark Hamburg has returned to Adobe as of about a month after the comment referring to him having left Adobe &#8220;a long time ago.&#8221; Here&#8217;s a current link to <a href="http://www.linkedin.com/profile/view?id=10387226&amp;authType=name&amp;authToken=nfvt&amp;locale=en_US&amp;pvs=pp&amp;trk=ppro_viewmore" rel="nofollow">his LinkedIn</a>.  This needn&#8217;t be a separate comment, but whatever. Here&#8217;s John Nack&#8217;s <a href="http://blogs.adobe.com/jnack/2009/07/mark_hamburg_returns_to_adobe.html" rel="nofollow">post</a> on it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Snyder</title>
		<link>http://regex.info/blog/lua/sha1#comment-42902</link>
		<dc:creator>James Snyder</dc:creator>
		<pubDate>Tue, 03 May 2011 23:56:12 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-42902</guid>
		<description>Lua definitely has its blemishes and it&#039;s far from perfect.  And, I think on some fronts like the continue keyword they would likely have included it in earlier version if it weren&#039;t for some problems it would introduce like breaking the semantics of repeat..until.  It lacks some features and patterns and leaves them to the end developer or whoever is embedding Lua in another application to provide.  Some of these are irritating because it leads to a lack of consistency in how people implement things like object orientation, etc...

All that said, the designers of the Language have very clearly stated on many occasions that they&#039;re _not_ trying to please everybody.  The goal of the language is not for it to work everywhere in every context.  For example, it probably wouldn&#039;t make a great language for numerical simulations, though you could probably use it for that.

If you&#039;re interested in listening to Roberto talk about some of the tradeoffs, he gave a talk at Stanford last year:
&lt;a href=&quot;http://ee380.stanford.edu/cgi-bin/videologger.php?target=100310-ee380-300.asx&quot; rel=&quot;nofollow&quot;&gt;video (windows media streaming)&lt;/a&gt;  and &lt;a href=&quot;http://www.stanford.edu/class/ee380/Abstracts/100310-slides.pdf&quot; rel=&quot;nofollow&quot;&gt;slides&lt;/a&gt;.

I really don&#039;t think you can accuse the current version of being thrown together haphazardly, especially given some of it&#039;s technical feats and some of the rather nice and beautiful features it has. Lua 5.x is the first register-based VM to get widely used, and the 5.x design has been a major influence in the last few years&#039; rounds of JavaScript engine optimizations we&#039;ve seen.  That said, I&#039;m damned sure Roberto and others who work on Lua regret some of the early language decisions that they now can&#039;t take back.  These, are, I think the sources of some of some of the more minor irritations you&#039;ve expressed in some of the comments above.

I think Adobe also shares some significant blame in how easy it is to work with the Lua that they&#039;ve embedded.  I&#039;ve personally have not worked with pure Lua codebases of the Length it sounds like your plugins approach (100kloc+), but having worked with Lua in separate contexts where _I_ was doing the embedding or working with it standalone, I can definitely say I was not hugely impressed with what I saw when I grabbed the &quot;SDK&quot; for Lightroom (after noticing it was extensible through Lua), and I don&#039;t envy having to try and debug code within what looked to be that rather limited and sandboxed environment.  One of the things that&#039;s really nice about it is the C API and how easy it is to extend (certainly there are those who complain about the C API being stack based, but whatever, I disagree with this). It&#039;s really dead simple to add functionality to Lua with C code.

Also, &lt;a href=&quot;http://lua-users.org/wiki/SecureHashAlgorithm&quot; rel=&quot;nofollow&quot;&gt;here&#039;s SHA224/SHA256&lt;/a&gt; with the availability of the bit functions in Lua 5.2.  It looks a fair bit less painful.</description>
		<content:encoded><![CDATA[<p>Lua definitely has its blemishes and it&#8217;s far from perfect.  And, I think on some fronts like the continue keyword they would likely have included it in earlier version if it weren&#8217;t for some problems it would introduce like breaking the semantics of repeat..until.  It lacks some features and patterns and leaves them to the end developer or whoever is embedding Lua in another application to provide.  Some of these are irritating because it leads to a lack of consistency in how people implement things like object orientation, etc&#8230;</p>
<p>All that said, the designers of the Language have very clearly stated on many occasions that they&#8217;re _not_ trying to please everybody.  The goal of the language is not for it to work everywhere in every context.  For example, it probably wouldn&#8217;t make a great language for numerical simulations, though you could probably use it for that.</p>
<p>If you&#8217;re interested in listening to Roberto talk about some of the tradeoffs, he gave a talk at Stanford last year:<br />
<a href="http://ee380.stanford.edu/cgi-bin/videologger.php?target=100310-ee380-300.asx" rel="nofollow">video (windows media streaming)</a>  and <a href="http://www.stanford.edu/class/ee380/Abstracts/100310-slides.pdf" rel="nofollow">slides</a>.</p>
<p>I really don&#8217;t think you can accuse the current version of being thrown together haphazardly, especially given some of it&#8217;s technical feats and some of the rather nice and beautiful features it has. Lua 5.x is the first register-based VM to get widely used, and the 5.x design has been a major influence in the last few years&#8217; rounds of JavaScript engine optimizations we&#8217;ve seen.  That said, I&#8217;m damned sure Roberto and others who work on Lua regret some of the early language decisions that they now can&#8217;t take back.  These, are, I think the sources of some of some of the more minor irritations you&#8217;ve expressed in some of the comments above.</p>
<p>I think Adobe also shares some significant blame in how easy it is to work with the Lua that they&#8217;ve embedded.  I&#8217;ve personally have not worked with pure Lua codebases of the Length it sounds like your plugins approach (100kloc+), but having worked with Lua in separate contexts where _I_ was doing the embedding or working with it standalone, I can definitely say I was not hugely impressed with what I saw when I grabbed the &#8220;SDK&#8221; for Lightroom (after noticing it was extensible through Lua), and I don&#8217;t envy having to try and debug code within what looked to be that rather limited and sandboxed environment.  One of the things that&#8217;s really nice about it is the C API and how easy it is to extend (certainly there are those who complain about the C API being stack based, but whatever, I disagree with this). It&#8217;s really dead simple to add functionality to Lua with C code.</p>
<p>Also, <a href="http://lua-users.org/wiki/SecureHashAlgorithm" rel="nofollow">here&#8217;s SHA224/SHA256</a> with the availability of the bit functions in Lua 5.2.  It looks a fair bit less painful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zet</title>
		<link>http://regex.info/blog/lua/sha1#comment-41832</link>
		<dc:creator>Zet</dc:creator>
		<pubDate>Tue, 04 Jan 2011 18:52:45 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-41832</guid>
		<description>Hi Jeffrey,

If you need a bit more speed on handling sha, you might want to look at the implementation I did based on yours (well, the tests are from your code, the rest is mostly rewritten). It&#039;s roughly about 10 times faster, so it might be of interests for other users as well.

&lt;a href=&#039;http://cube3d.de/uploads/Main/sha1.txt&#039; rel=&quot;nofollow&quot;&gt;http://cube3d.de/uploads/Main/sha1.txt&lt;/a&gt;

Greetings from Germany,
Zet

&lt;span class=&#039;jfriedl&#039;&gt;Look very cool... I don&#039;t need the speed for my uses so don&#039;t need to trade off for the upfront work and for the space your approach uses, but most people will probably find yours to be much preferred. Thanks for sharing! &#8212;Jeffrey&lt;/span&gt;</description>
		<content:encoded><![CDATA[<p>Hi Jeffrey,</p>
<p>If you need a bit more speed on handling sha, you might want to look at the implementation I did based on yours (well, the tests are from your code, the rest is mostly rewritten). It&#8217;s roughly about 10 times faster, so it might be of interests for other users as well.</p>
<p><a href='http://cube3d.de/uploads/Main/sha1.txt' rel="nofollow">http://cube3d.de/uploads/Main/sha1.txt</a></p>
<p>Greetings from Germany,<br />
Zet</p>
<p><span class='jfriedl'>Look very cool&#8230; I don&#8217;t need the speed for my uses so don&#8217;t need to trade off for the upfront work and for the space your approach uses, but most people will probably find yours to be much preferred. Thanks for sharing! &mdash;Jeffrey</span></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Horne</title>
		<link>http://regex.info/blog/lua/sha1#comment-41628</link>
		<dc:creator>Chris Horne</dc:creator>
		<pubDate>Mon, 13 Dec 2010 19:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-41628</guid>
		<description>Amen, brother!

I&#039;ve been working on our first commercial Lua plugin (for iPadLightroom synchronization), and after ~15k lines of lua code and far too many hours banging my head against the wall, I can&#039;t agree with you more here. Perl&#039;s tagline is sometimes &quot;Making the easy things easy and hard things possible&quot;; lua&#039;s tagline has to be something along the lines of &quot;Making the easy things hard and the hard things impossible&quot;. It&#039;s atrocious. And using it within the confines of Lightroom is even more so.

I&#039;ve been programming professionally for 18 years- everything from esoteric and academic languages such as ML and Prolog to modern OO languages. Never have I experienced as bad as lua. To say it&#039;s poorly designed is an understatement; you&#039;ve put it in better words than I&#039;ve been able to muster. 

What&#039;s more frustrating is Adobe&#039;s incomplete Lightroom exposure of basic lua functions. Want to check an environment variable? Good luck. Want to track background threads? Have fun with that. And on and on. To the person that commented that &quot;it&#039;s not lua&#039;s fault&quot; ... that may be, but lua is the language you&#039;re forced to work in if you&#039;re going to integrate with Lightroom.

As an aside, I did perl work for a few years, and your Regex book was my bible - even more than the perl &quot;camel book&quot;. Glad to see you still producing good, quality stuff for the community, even if it&#039;s in lua...</description>
		<content:encoded><![CDATA[<p>Amen, brother!</p>
<p>I&#8217;ve been working on our first commercial Lua plugin (for iPadLightroom synchronization), and after ~15k lines of lua code and far too many hours banging my head against the wall, I can&#8217;t agree with you more here. Perl&#8217;s tagline is sometimes &#8220;Making the easy things easy and hard things possible&#8221;; lua&#8217;s tagline has to be something along the lines of &#8220;Making the easy things hard and the hard things impossible&#8221;. It&#8217;s atrocious. And using it within the confines of Lightroom is even more so.</p>
<p>I&#8217;ve been programming professionally for 18 years- everything from esoteric and academic languages such as ML and Prolog to modern OO languages. Never have I experienced as bad as lua. To say it&#8217;s poorly designed is an understatement; you&#8217;ve put it in better words than I&#8217;ve been able to muster. </p>
<p>What&#8217;s more frustrating is Adobe&#8217;s incomplete Lightroom exposure of basic lua functions. Want to check an environment variable? Good luck. Want to track background threads? Have fun with that. And on and on. To the person that commented that &#8220;it&#8217;s not lua&#8217;s fault&#8221; &#8230; that may be, but lua is the language you&#8217;re forced to work in if you&#8217;re going to integrate with Lightroom.</p>
<p>As an aside, I did perl work for a few years, and your Regex book was my bible &#8211; even more than the perl &#8220;camel book&#8221;. Glad to see you still producing good, quality stuff for the community, even if it&#8217;s in lua&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Brickley</title>
		<link>http://regex.info/blog/lua/sha1#comment-38898</link>
		<dc:creator>Dan Brickley</dc:creator>
		<pubDate>Sun, 02 May 2010 18:01:32 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-38898</guid>
		<description>Hi! Thanks for sharing your code, regardless of whether you love Lua or not.

A simple question: what&#039;s the software license with this? Are there any constraints on re-use, redistribution that you&#039;d like respected?

&lt;span class=&#039;jfriedl&#039;&gt;Feel free to use it as you like. &#8212;Jeffrey&lt;/span&gt;</description>
		<content:encoded><![CDATA[<p>Hi! Thanks for sharing your code, regardless of whether you love Lua or not.</p>
<p>A simple question: what&#8217;s the software license with this? Are there any constraints on re-use, redistribution that you&#8217;d like respected?</p>
<p><span class='jfriedl'>Feel free to use it as you like. &mdash;Jeffrey</span></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Ranft</title>
		<link>http://regex.info/blog/lua/sha1#comment-38683</link>
		<dc:creator>Richard Ranft</dc:creator>
		<pubDate>Sun, 11 Apr 2010 02:37:25 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-38683</guid>
		<description>You should just try embedding Lua in a c/c++ program and see what you think.  Just try it.  Seriously.

Once you&#039;ve done this, and looked through the code, and added your next and continue statements if you wish, you might have a different take on it.  You might realize that when the Adobe programmers embedded the scripting language they might not have done things as nicely as is possible, or that they didn&#039;t envision someone trying to code an SHA-1 hash on the wrong side of a script engine.  Lua has the capability to load external libraries, just code one up using the examples provided in the free docs, load your library and away you go.

I&#039;ve spent 29 years programming in assembly for the 6502 and 80x86 processors, various flavors of BASIC, COBOL, PASCAL, C/C++, Java, Lua, various shell script systems and I&#039;m telling you that Lua is most assuredly not the worst scripting language you could use.  A significant number of game projects use it - and everyone who&#039;s ever worked on one knows that performance is something of an issue there.  I hardly consider any amount of experience with Lua as an extension to a single application as definitive;  there are just too many different ways to handle the embedding and too many ways to hamstring your own performance.

Just work with it outside of your one-application frame of reference and you might actually like it, that&#039;s all I&#039;m trying to say.  Your original post is reminiscent of saying that you hate Chinese food because the only restaurant you ever tried it at stank.  I&#039;m sure that if I really tried I could do an even worse embedding job than Lightroom&#039;s (theirs is probably pretty good, just not intended for what you did with it).  Adobe Lightroom isn&#039;t what I would call &quot;framerate intensive&quot; so I&#039;m sure they weren&#039;t too worried about blazingly fast implementations.

&lt;span class=&#039;jfriedl&#039;&gt;I appreciate your take on things (I have similar experience as you, though no COBOL in my playbook), and I agree that Lua is not the worst scripting language, in absolute terms nor for this specific situation. But that doesn&#039;t mean it&#039;s good in either context, either. Lua was apparently designed by someone without the kind of experience we have... I just can&#039;t imagine a competent engineer designing this language. It has some wonderful attributes and areas of beauty, but it&#039;s not at all designed to be used in the real world. (It *is* used in the real world, and hence my complaints.) &#8212;Jeffrey&lt;/span&gt;</description>
		<content:encoded><![CDATA[<p>You should just try embedding Lua in a c/c++ program and see what you think.  Just try it.  Seriously.</p>
<p>Once you&#8217;ve done this, and looked through the code, and added your next and continue statements if you wish, you might have a different take on it.  You might realize that when the Adobe programmers embedded the scripting language they might not have done things as nicely as is possible, or that they didn&#8217;t envision someone trying to code an SHA-1 hash on the wrong side of a script engine.  Lua has the capability to load external libraries, just code one up using the examples provided in the free docs, load your library and away you go.</p>
<p>I&#8217;ve spent 29 years programming in assembly for the 6502 and 80&#215;86 processors, various flavors of BASIC, COBOL, PASCAL, C/C++, Java, Lua, various shell script systems and I&#8217;m telling you that Lua is most assuredly not the worst scripting language you could use.  A significant number of game projects use it &#8211; and everyone who&#8217;s ever worked on one knows that performance is something of an issue there.  I hardly consider any amount of experience with Lua as an extension to a single application as definitive;  there are just too many different ways to handle the embedding and too many ways to hamstring your own performance.</p>
<p>Just work with it outside of your one-application frame of reference and you might actually like it, that&#8217;s all I&#8217;m trying to say.  Your original post is reminiscent of saying that you hate Chinese food because the only restaurant you ever tried it at stank.  I&#8217;m sure that if I really tried I could do an even worse embedding job than Lightroom&#8217;s (theirs is probably pretty good, just not intended for what you did with it).  Adobe Lightroom isn&#8217;t what I would call &#8220;framerate intensive&#8221; so I&#8217;m sure they weren&#8217;t too worried about blazingly fast implementations.</p>
<p><span class='jfriedl'>I appreciate your take on things (I have similar experience as you, though no COBOL in my playbook), and I agree that Lua is not the worst scripting language, in absolute terms nor for this specific situation. But that doesn&#8217;t mean it&#8217;s good in either context, either. Lua was apparently designed by someone without the kind of experience we have&#8230; I just can&#8217;t imagine a competent engineer designing this language. It has some wonderful attributes and areas of beauty, but it&#8217;s not at all designed to be used in the real world. (It *is* used in the real world, and hence my complaints.) &mdash;Jeffrey</span></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arturo Monroy</title>
		<link>http://regex.info/blog/lua/sha1#comment-38292</link>
		<dc:creator>Arturo Monroy</dc:creator>
		<pubDate>Tue, 23 Feb 2010 17:34:18 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-38292</guid>
		<description>Great, thank for you effort, i test it and ill include into a own librarie for freeswitch.

Thanks.

Regards from Mexico</description>
		<content:encoded><![CDATA[<p>Great, thank for you effort, i test it and ill include into a own librarie for freeswitch.</p>
<p>Thanks.</p>
<p>Regards from Mexico</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gé</title>
		<link>http://regex.info/blog/lua/sha1#comment-37880</link>
		<dc:creator>Gé</dc:creator>
		<pubDate>Fri, 15 Jan 2010 15:14:13 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-37880</guid>
		<description>Lua was designed as a small language for embedding in applications, not for standalone use. So it does not scratch every itch a programmer may have, you add your own functionality when you need it (which includes an object system). I&#039;ve added SHA-256, date arithmetic and other stuff without trouble, and it&#039;s definitely easier than adding extensions to Python, which I have done too, I&#039;ve written large apps in a combination of Python and C, and I would do the same with Lua.

I seriously doubt that Adobe wrote their image manipulation routines in Lua. If their implementation in LR does not allow 3rd parties to add their own C extension libraries you need to take that up with them. Writing SHA1 or any crypto code in Lua is an inappropriate use of the language.

The &#039;continue&#039; issue is a matter of taste, a correct implementation of tail recursion is more important to me, as is a decent garbage collector and a lack of bloat. I suggest writing some programs in a pure functional language just to get a new perspective, you don&#039;t even get &#039;while&#039; :-)

&lt;span class=&#039;jfriedl&#039;&gt;Writing SHA-1 is an &lt;i&gt;inappropriate use&lt;/i&gt; of the language? Miss Manners is now reading tech blogs? :-)  &lt;i&gt;Indentation&lt;/i&gt; is a matter of taste. How one &lt;i&gt;capitalizes identifiers&lt;/i&gt; is a matter of taste,  but basic language constructs are just that, basic language constructs, and if you don&#039;t have them, you have to go through verbose and awkward hoops whose complexity can increase dramatically in very short order.  It&#039;s just another example of how Lua is not designed for creating readable code. (A lot of popular languages have designs that do not encourage or facilitate readable code, but that doesn&#039;t mean it&#039;s not a problem.)  What might be a simple, clear, 10-line loop in most any other language can become a deep, cumbersome rats&#039; nest of conditionals in Lua.  There&#039;s a &lt;i&gt;reason&lt;/i&gt; we don&#039;t program with nand gates. &#8212;Jeffrey&lt;/span&gt;</description>
		<content:encoded><![CDATA[<p>Lua was designed as a small language for embedding in applications, not for standalone use. So it does not scratch every itch a programmer may have, you add your own functionality when you need it (which includes an object system). I&#8217;ve added SHA-256, date arithmetic and other stuff without trouble, and it&#8217;s definitely easier than adding extensions to Python, which I have done too, I&#8217;ve written large apps in a combination of Python and C, and I would do the same with Lua.</p>
<p>I seriously doubt that Adobe wrote their image manipulation routines in Lua. If their implementation in LR does not allow 3rd parties to add their own C extension libraries you need to take that up with them. Writing SHA1 or any crypto code in Lua is an inappropriate use of the language.</p>
<p>The &#8216;continue&#8217; issue is a matter of taste, a correct implementation of tail recursion is more important to me, as is a decent garbage collector and a lack of bloat. I suggest writing some programs in a pure functional language just to get a new perspective, you don&#8217;t even get &#8216;while&#8217; <img src='http://regex.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><span class='jfriedl'>Writing SHA-1 is an <i>inappropriate use</i> of the language? Miss Manners is now reading tech blogs? <img src='http://regex.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   <i>Indentation</i> is a matter of taste. How one <i>capitalizes identifiers</i> is a matter of taste,  but basic language constructs are just that, basic language constructs, and if you don&#8217;t have them, you have to go through verbose and awkward hoops whose complexity can increase dramatically in very short order.  It&#8217;s just another example of how Lua is not designed for creating readable code. (A lot of popular languages have designs that do not encourage or facilitate readable code, but that doesn&#8217;t mean it&#8217;s not a problem.)  What might be a simple, clear, 10-line loop in most any other language can become a deep, cumbersome rats&#8217; nest of conditionals in Lua.  There&#8217;s a <i>reason</i> we don&#8217;t program with nand gates. &mdash;Jeffrey</span></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Maher</title>
		<link>http://regex.info/blog/lua/sha1#comment-37864</link>
		<dc:creator>Brian Maher</dc:creator>
		<pubDate>Wed, 13 Jan 2010 14:29:38 +0000</pubDate>
		<guid isPermaLink="false">http://regex.info/blog/lua/sha1#comment-37864</guid>
		<description>Jeff,

Sorry to hear your troubles with Lua, I think a lot of the troubles you are having with Lua are because the language wasn&#039;t intended to write low-level algorithms like SHA-1.  I think that if you had learned the language from a different context (like using it as a language embedded in your program) you would have had a better experience.

Some things that I personally like about Lua are:

  * coroutines - Enables my event loop programs to appear linear (similar to lisp&#039;s call/cc).
  * Small/Simple - This is important when embedding.
  * Garbage Collection - Not reference counting like Perl!
  * Well Documented C API - Can&#039;t say that about Perl (`man perlguts`).

I loved your book on regular expressions, perhaps the next edition could even talk a little about lua&#039;s patterns?

BTW, break is mentioned in the manual here:

http://www.lua.org/manual/5.1/manual.html#2.4.5

Issaquah, WA

&lt;div class=&#039;jfriedl&#039;&gt;&lt;p&gt;First of all, let me thank you for not calling me nasty names. :-)&lt;/p&gt;&lt;p&gt;I know about &lt;b&gt;break&lt;/b&gt;, thank you.... it&#039;s &lt;b&gt;continue&lt;/b&gt; or &lt;b&gt;next&lt;/b&gt; whose absence I find inexcusable in a non-toy language. Its omission can severely reduce the readability of code.&lt;/p&gt;&lt;p&gt;And I *am* using Lua embedded in a program.... in Adobe Lightroom...  I have more than a dozen plugins, most with 100k lines of Lua. &lt;/p&gt;&lt;p&gt;Lua has built-in arc-cosine, but no bitwise AND? In an &lt;i&gt;embedded&lt;/i&gt; language? Where&#039;s the sense in that?  Had the Lua designers spent the extra 10 minutes to add Math.xor() and friends, and a half an hour to add and document some kind of &quot;continue&quot;, that would have gone a long way toward avoiding people thinking that they are pretty clueless about real-world programming.&lt;/p&gt;&lt;p&gt;All in all it strikes me as if they wanted to play around with some interesting core ideas, and left the rest of the language at whatever minimal state their disinterest left it in. While engaged in this endeavor they just happened to want to do something that involved a lot of geometry, so they added a bunch of Math stuff. Had they been sick that day, the Math library would be much smaller. That&#039;s how it all strikes me.... monumentally haphazard. &#8212;Jeffrey&lt;/p&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Jeff,</p>
<p>Sorry to hear your troubles with Lua, I think a lot of the troubles you are having with Lua are because the language wasn&#8217;t intended to write low-level algorithms like SHA-1.  I think that if you had learned the language from a different context (like using it as a language embedded in your program) you would have had a better experience.</p>
<p>Some things that I personally like about Lua are:</p>
<p>  * coroutines &#8211; Enables my event loop programs to appear linear (similar to lisp&#8217;s call/cc).<br />
  * Small/Simple &#8211; This is important when embedding.<br />
  * Garbage Collection &#8211; Not reference counting like Perl!<br />
  * Well Documented C API &#8211; Can&#8217;t say that about Perl (`man perlguts`).</p>
<p>I loved your book on regular expressions, perhaps the next edition could even talk a little about lua&#8217;s patterns?</p>
<p>BTW, break is mentioned in the manual here:</p>
<p><a href="http://www.lua.org/manual/5.1/manual.html#2.4.5" rel="nofollow">http://www.lua.org/manual/5.1/manual.html#2.4.5</a></p>
<p>Issaquah, WA</p>
<div class='jfriedl'>
<p>First of all, let me thank you for not calling me nasty names. <img src='http://regex.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I know about <b>break</b>, thank you&#8230;. it&#8217;s <b>continue</b> or <b>next</b> whose absence I find inexcusable in a non-toy language. Its omission can severely reduce the readability of code.</p>
<p>And I *am* using Lua embedded in a program&#8230;. in Adobe Lightroom&#8230;  I have more than a dozen plugins, most with 100k lines of Lua. </p>
<p>Lua has built-in arc-cosine, but no bitwise AND? In an <i>embedded</i> language? Where&#8217;s the sense in that?  Had the Lua designers spent the extra 10 minutes to add Math.xor() and friends, and a half an hour to add and document some kind of &#8220;continue&#8221;, that would have gone a long way toward avoiding people thinking that they are pretty clueless about real-world programming.</p>
<p>All in all it strikes me as if they wanted to play around with some interesting core ideas, and left the rest of the language at whatever minimal state their disinterest left it in. While engaged in this endeavor they just happened to want to do something that involved a lot of geometry, so they added a bunch of Math stuff. Had they been sick that day, the Math library would be much smaller. That&#8217;s how it all strikes me&#8230;. monumentally haphazard. &mdash;Jeffrey</p>
</div>
]]></content:encoded>
	</item>
</channel>
</rss>

