Project Nayuki

Decent feedback from readers

Here are examples of decent email feedback that I receive from readers of the site. This is intended to contrast with the examples of poor feedback from readers.

Generally speaking I give positive or neutral responses to every decent email I receive. This would mean answering the questions, commenting from my experience and knowledge, and providing other useful information. Also I generally approve requests to license my code/work, because most requests are for academic purposes.

The collection illustrated here is only a small sample of all the emails I receive. The writing style of the author is preserved (such as line breaks and spelling), but sensitive details have been removed or altered, denoted in [square brackets].

In the case where the person provides a clearly public GitHub or academic link in the email text, I do confirm that the public information shows their name already, and then I proceed to show their name here as well.

from [SC]

Subject line: Thank you for your work.

I recently stumbled upon your website in search of a minimalist PNG library.
Not only I ended up finding exactly what I was looking for (not the case most of the times) and using it on my recently published project [...], but I also ended up enjoying many of your articles about cryptography and algorithms.
I'm glad I found you, you've got some serious quality content in there.
Keep up the great work, people like you give me hope.

Best regards,

from [OM]

Subject line: Nayuki Project

I was looking for some Project Euler resolutions for mind-sharpening reasons and stumbled on your blog. A few posts in and I was really impressed. Not only you have some rare-jewel-quality content, your writing is also superb, which unfortunately is often overlooked in the STEM field. Your website is on my bookmarks bar for easy access already.
In another stroke of luck, I've found this [...]'s website, which has a close spot to yours in my favorites. If you are interested, you'll quickly notice he's a lot more merciful on the layman than you, but it is very possible to find interesting and advanced tech-related content there. If anything, the guy reads a lot and posts a lot of well-written book summaries. Take a look if you will: https://[...]
Also, based on your youtube tastes, I'd like to recommend you the [...] channel:[...]

That's it, no proposals or anything of the sort, just a very honest compliment and some recommendations I hope you'll like. Keep up the good work, I'm always glad to conceive the existence of people like you.

from [RC]

Subject line: Thanks for your contributions

Hi Nayuki,

I am [R], from Barcelona, Spain. I recently started doing some Project Euler problems to practice some maths and some coding while having fun.

When I was working on the problems I found your repository and your website.

I just wanted to thank you for your resources. I think your website is amazing with lots of interesting material and your repositories are great. I always solve the problem before taking a look on how you did but is good to take a look on how someone else tackled the problem.

I mainly work with Python and I used to give some talks on some conferences. In case you are curious:

Keep up with the good work,
Kind Regards,

from [WKG]

Subject line: FFT


Thank you, thank you, thank you for posting your FFT implementation. I am working on a C/C++ implementation of [...] for my own edification. I've been swapping back and forth between Octave and C for computation and visualization. In C/C++ I had been using Numerical Recipes, but that approach comes with some downsides. I looked all around for a free FFT implementation, and for some reason didn't jump all over yours, right away. I knew from NR that four1.c could do the trick in 50 lines of code, so I couldn't understand why everyone else had to make it so complicated. Anyway, I snapped in your work, and it filled the bill. I'll likely be back for your Gauss-Jordan code when I get to solving the least-squares for position. So, thank you again. I'd send you some Bitcoin, but are you sure you want Bitcoin?

There was one modification I made to fft.h, neither MSVC++ nor g++ knew what M_PI was. I added a #ifndef, and it was off to the races.



from [T]

Subject line: Your QR code library

Working on an "iot" project and thought displaying a QR code would solve a big problem.

Thank you for your QR code libraries. I already have it working in windows. As soon as the display for the iot gizmo shows up, I'll put it to real use.


from [S]

Subject line: License Request

I would like to license your Vigenere cipher code at
I would happily be able to pay you in cryptocurrency. Thanks!

from [AT]

Subject line: Thank You!

Hi Nayuki,

I am a student at [...] Chengdu. Recently, I came across your website and your post “Gauss-Jordan elimination over any field” while I was trying to solve tedious linear systems using identity matrices. Your code was very concise and elegant. I’m really interested in coding and still keep learning things from your website every day!

I appreciate the excellent quality of work on your website and hope you keep it up.

I wish you a merry Christmas and a happy new year in advance!

Best Regards,


from [LC]

Subject line: Appreciate

Hi Nayuki,

Recently, I reached one of your GitHub project about QR code and it leads me to reach your website. And found out that you have done a number of projects.

I appreciate your hard work. And keep going.

Best wishes,

from [JA]

Subject line: Happy new year.

Hello, Nayuki

I'm just sending this email to wish you a happy new year.
I hope 2018 is good year for you and that you can keep doing your excellent work on your website! :D

Best wishes,

from [SM]

HI nayuki. Your work is very inspiring. I'm a CS undergrad myself and everyday I learn something new from your site. Thankyou so much.

from [YZ]

Your website is so cool, every post has high quality and I can tell you put a lot of effort it them. Just want to express my feeling: your website shocked me!

please keep working on it!

Best wishes

from [MH]

Subject line: forcing-a-files-crc-to-any-value

I think I found a Bug, as your C code doesn't work. The resultant file does have a different CRC32 code, but not the one specified.

My test file [27 bytes] contains only the quote "This File is 27 bytes long!" has a natural crc of  [C1336C90]

Running your code  with  offset 7  newcrc 0000AAAA
C:\MinGW\CRC32>a Test.txt 7 0000AAAA
Original CRC-32: C1336C90
Computed and wrote patch
Assertion error: Failed to update CRC-32 to desired value

Running the same parameters on the resultant file makes the file alternate between  [CB6FD37C] and [5E86B670]

Normally the byte delta would be 0x00 if the R'(x) = R(x) so alternating per run is not right.

Stranger yet..
Directly feeding its own crc back into the original file "a Test.txt 7 C1336C90" produces a crc of [0A5C1546] again wrong.
but over sequential executions the output will again alternate between [0A5C1546] and [C1336C90] so half of the executions are  "New CRC-32 successfully verified"

Quick checking the code,  It is writing in the correct place, altering only 4 Bytes, and is correctly computing the file length.

My Environment
OS: Win Xp 32bit Sp3
Compiler: MinGW  (gcc)

C:\MinGW\CRC32>gcc -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.6.2/configure
--disable-sjlj-exceptions --with-dwarf2 --enable-shared
--enable-libgomp --disable-win32-r
egistry --enable-libstdcxx-debug
--enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.6.2 (GCC)

Complied without errors or warnings "gcc forcecrc32.c"

My guess is its a 32/64 bit error and your testing was on a 64bit native OS.   I'm including my compiled executable, test file and output to see if you notice something obvious. Google's  ban  on compiled .exe files (annoying) so I ziped the zip with a password "Nayuki"  no quotes to block gmail from seeing the .exe extention


[ZIP file attached]

from MNK

Subject line: Mail of Thanks

Dear Ms Nayuki,

I'm writing this mail to convey my thanks to you for the article 'Next lexicographical permutation algorithm'. I was practising algorithmic programming problems on HackerRank when I came around the need to find the next lexical permutation of a given string. I tried solving it on paper, but was unable to devise the correct algorithm. Then I googled the problem, came across your article, and I found it to be really wonderful. The article has been written in great detail, in a step-by-step manner. Now I do understand the algorithm. Thank you very much for writing such a nice article.

There are two more things I'd like to say.

First, I read the page named 'Poor feedback from readers' and I found it to be full of humour. I couldn't help myself but to read it to the bottom and to laugh.

Second, not all people from India address ladies using 'sir'. (I'm also from India) :)

Good work. Keep it up.


from ZG

Subject line: minor mistake

I really loved you website, keep it up!

at I think there is an error:
(high integrity and high perforance)

from BW

Subject line: Good Java Idioms

I enjoyed your page, but also thought I'd pass along some recommended updates.  Since Java 7 and the java.nio.file package there are some extremely useful, but little known, gems:

Reading lines from a file into a List:

List<String> lines = Files.readAllLines(Paths.get("file.txt"));

Processing one line at a time as a stream (Java 8):

Files.lines(Paths.get("file.txt")).forEach(line -> { /* process line */ });

Read file as binary into a byte array:

byte[] bytes = Files.readAllBytes(Paths.get("file.bin"));

Writing a List of Strings to a file:

Files.write(Paths.get("output.txt"), lines);


from EM

Subject line: Use of FFT code in Javascript Web Application

Hi Nayuki,

My name is [EM], I'm a [...] researcher at the University of [USA]. I study human visual perception and have employed your fft.js file in my implementation of a [...] model of [...]-- the [...] model.

The website can be found here, and a journal article outlining the model and describing its didactic value will be submitted to the journal "[...]". A link to your web-page is provided both in the footer of the website and in the "Acknowledgements" section of our manuscript.

I'd like to thank you for providing the code under the MIT license and for facilitating the development of this tool in vision research. If you have any questions or concerns, please don't hesitate to let me know.


University of [USA]
[Degree] | [Department]
[Title] | [Laboratory]
[Email address]
[Phone number]

from EG

Subject line: Manufactoria - Better solution for officers?

Hi Nayuki!  I've been replaying through Manufactoria and think I have an improvement for the Officers puzzle; you list 44 parts but this solution does it in 34.  My solution is the same conceptual algorithm: green to mark the end of the string, yellow to indicate that the previous bit needs to be added, special case to put a blue at the front if necessary.  I think the layout is just more compact.

As a sidenote, I am confused by your picture which shows two conveyors on the same square.  Thanks for the site!  It's fun seeing how close I come to optimal in my solutions :-)


[Screenshot attached]

from DB

Subject line: Thanks for helping me with FFT! :D

Hey, I recently read up on the article you had about DFT ( and I thought I would thank you for helping me implement it.  Coming from a programming-only background, I found it incredibly helpful :)  My math skills aren't really that great, but I appreciate the stuff you put on the page to help me understand some mathematical notation. Again, thank you! :)

from DW

Subject line: Great Website


I was looking around for a VBA Implementation of the Knuth-Morris-Pratt algorithm and I came across your Web-site.

Since I have been working a lot with Javascript recently, I used your JS version as a model to port to VBA. It worked a treat.. BTW, if this is of any use to you, let me know and I will send it to you..

I just wanted say, I love your web-site, It's very informative, honest, crisp and clear. I suspect it closely reflects your mind...

Best regards

from AB

Subject line: License: Gauss-Jordan elimination over any field (Java)

Hi Nayuki,

I'm a student at the [...] University, Germany, and I've written a library for [...] and needed to invert [...]. For that I've used your Gauss-Jordan elimination over any field (Java) code. The library should be released under GPL v2.0 on GitHub. I've only used the two core files and added my own Field wrapper for the existing [...].

After including your code, I've actually used another approach of [...]. I've looked elsewhere, but haven't found an alternative that enables abstract matrix elements. I hope I have your blessing to include it in the library. If you have any objections or questions, please ask.


from WR

Subject line: Full Page Clock

Hi there,

You have a wonderful script for full page. I have a suggestion which would be cool if you could incorporate. Currently your “PM” in the full screen clock is taking about 1/3 of the computer screen. It could be fantastic if you could enable a version that had the PM either in very small font or not at all (without going to the 24 hour clock).

This is the page:

Would be so cool. Thanks for the great work.


PS: hello fellow Torontonian!

Glad to see that someone from Toronto is doing such cool things

[Screenshot attached]

from Kenji Rikitake

Subject line: C code of your SHA512 (all under MIT License) are included in my FreeBSD TRNG feeder distribution

As requested in
this is a brief notice that your C code of
(both distributed under MIT License)
are included in the following GitHub repository of mine
as a part of feeder to FreeBSD true random number generator device driver:

Your code is easy to understand and works OK for my purpose.
I appreciate you distribute the files under the MIT License.

Kenji Rikitake

from ML

Subject line: Implementing the discrete fourier transform

Hi Nayuki,

I was searching for an easy to understand implementation/explanation of the DFT and came across your site, specifically which helped to clarify things immensely (thanks!).

One piece of constructive criticism I have is regarding the Java sample code. In it you multiply 2 * Math.PI "k" to the "t" times which isn't necessary. It would make more sense to calculate 2 * Math.PI once and store it in a final variable.

Thanks again for the great explanation.


from EB

Subject line: Comments on three of your articles


I found you site ( while searching the Web for “relative aperture”. Then, as it appeared to have a few very nice articles, I got a little bit hooked browsing around... I am writing to send some praise, as well as some comments and suggestions on three of your articles:

Absolute and relative lens apertures

I got here because I am editing the French Wikipedia article on this subject ( That article states that “relative aperture” is just another name for “f-number” (i.e. f/d, were d is the pupil diameter). The English version of the article says the same. This is at odds with what I remember from my optics lessons, where “relative aperture” is d/f, the inverse of the f-number. It is also at odds with the usual meaning of “relative” in physics, where “relative foo” means “foo divided by some reference”.

Looking through the Web, it appears that and define “relative aperture” as f/d, whereas and your site define it as d/f. I really dislike the f/d definition, because it works backwards to what “aperture” is supposed to mean. If you have some authoritative reference on the d/f definition, I would greatly appreciate if you send me a pointer.

Now, a more trivial comment, but since you seem to be a perfectionist...

In the section “Basics of absolute apertures”, you wrote “The amount of light a lens receives from the environment is proportional to the area of the lens’s front surface.”. Then, right in the next paragraph, “The area of a lens’s front surface is proportional to how much light it receives from the environment.”. I do not know whether this is intended, but it sounds like a redundant repetition to me.

Handling physical quantities in math formulas

Thank-you so much for publishing this! I have to keep a pointer to this page... As a physicist, I am tired of seeing so many formulas that only work with a particular choice of units. I am the guy who added the units (lx⋅s) to the definitions in . Your article is a very good primer on the proper use of units, and it is suitable for a general public. Well done! I have a few suggestions though:

Section “Unit conversions”

Your division expressions look odd to me. This is not the way I (and I guess, most physicists) think about it. It seems easier and more intuitive to just replace the initial unit by its value in the target unit. For example, given that

    1 ft = 0.3048 m
    1 m = 0.001 km

your example conversion would be done as follows:

    3125 ft = 3125 × (1 ft)
        = 3125 × 0.3048 m
        = 3125 × 0.3048 × (1 m)
        = 3125 × 0.3048 × 0.001 km
        = 0.9525 km

This seems like a more natural path of thought than multiplying by fractions equal to one.

Section “Functions”

You wrote

    h(t) = (−4.9 (t/s)² + 8 (t/s) + 3) m

This manner of dividing a quantity by its unit is uncommon. I have only seen it used on graphs, where someone would label an axis “t/s” instead of “t (in s)”. And it makes a lot of sense. I really like the way you use this form to “fix” an otherwise inconsistent equation. To stay in the same spirit, I think it would be better to write “h(t)/m” on the left hand side of the equation, rather than adding “m” at the far right. This makes a more consistent recipe for fixing this kind of unit-dependent equation: replace every quantity by quantity/unit.

You also wrote h(t) in the form

    −4.9 t² m/s² + 8 t m/s + 3 m

This form, although obviously correct, looks awful to my eyes. I suggest you rewrite it as

    (−4.9 m/s²) t² + (8 m/s) t + (3 m)

as it more closely fits a more “canonical” way of writing the equation:

    h(t) = (a/2) t² + v₀ t + h₀

where a/2 = −4.9 m/s², etc.

Extending the use of logarithmic scales

Being myself a lover of logarithmic scales and slide rules, I find this idea quite compelling. There is, however, a problem of ambiguity if you try to extend the use of decibels: whereas the bel is often defined as a 10× factor in power, it is also very commonly defined as a √10× factor in amplitude. On the specs of a voltage amplifier, the latter definition is always used. If you talk in dB for something that is not obviously either a power or an amplitude, it becomes quite unclear whether you are generalizing the power-based or the amplitude-base definition.

This problem is specially evident in your example “Make your photo brighter by 3 dB”. If you use the aperture to increase the radiant power reaching the sensor, it only seems natural to use the power-based definition of the bel and say that 3 dB is one stop. However, once light reaches the sensor, it is converted into a voltage signal proportional to the exposure received, then this voltage is amplified according to your ISO setting. If you use this setting to make the image brighter, increasing the amplifier gain by 3 dB will brighten the image by half a stop. Thinking of the pixel values as an amplitude, rather than a power, is not uncommon: people with signal processing backgrounds always do this. Whenever you see the signal to noise ratio of a sensor quoted in dB, the signal and noise “powers” are the squared raw pixel values.

Best regards,


from JA

Subject line: Greetings!

Hi, Nayuki!
I'm 16 years old boy from Brazil and I found you while I was searching about Cryptography.
Well, I just want to say that I really liked your site and pics in Flickr.
I hope this isn't a bad email and/or this bothers you, but I really want to express my gratitude (I would donate Bitcoins if i had any :P)
That's it, keep doing your great work and I hope someday I can be such a good developer like you!
See you next time!

from PMF

Subject line: Hello Nayuki

Hello Nayuki, I have seen some of those email requesting help for free, quite amusing, I would like some help but not for free,

Let me explain first, I am working on a project and we require to optimize PNG image, to maximize file size for speed and performance.

Is your algorithm the same as TINY, or just a coincidental name?

I believe your optimization only  optimizes the colors and bit depth of PNG, does it also strip the meta data too?

one last question, in the case of Tiny, I am able to run optimization over and over to get more optimal results, in some case as much as 10x before it can find no more improvements, does your algorithm work the same way?

Any help you may be able to provide, please request a donation for your time and I will provide it,

Thanks again [S]

from Rasmus Winther Zakarias

Subject line: SHA x86 assembly code


My name is Rasmus, I am a researcher at the Cryptography group Aarhus University ( and I would like to ask permission to use your assembly/C code for the SHA-family of hash functions in a research project.

Great site you have going on there a lot of useful stuff, thanks for sharing !

Usage of the code:

Our project is described in the article: We invent an efficient generic Zero-knowledge protocol for the NP-statement of circuit-satisfiability and implement it to show feasibility (e.g. ZK suffers from being (practically)inefficient) and to the best of our knowledge we improve on this.

The simplest instantiation of the protocol is in the so call Random Oracle Model where we allow our self the existence of hash functions (which is a powerful assumption). This is where I found your outstanding work, at which I would like permission to use in this research project. It will be used in the research project only which is available to the general public at under the MIT license, however, your code will be used unedited with the intact copyright and link in the source. Also, the final version of the paper will include a thanks to you for providing an efficient implementation of the hash-function.

Best Regards

from HR

Subject line: Use of screenshot in University assignment


My name is [H] and I am in my final year of studying with [...] university in the UK. I am writing an assignment which includes a section explaining different types of encryption methods. I have been struggling to obtain some relevant and clear images of AES encryption, as my tutor recommends breaking up my text with diagrams and images, and was hoping I could use a screenshot taken from one of your excel documents.

I will clearly reference the screenshot using the [university]'s preferred Harvard style of referencing - see below

Project Nayuki, (2015), AES Cipher internals in Excel, [Online]

(Accessed 6th August 2015)

Can you please advise if this is acceptable.

Thank you


from MB

Subject line: Wikipedia PageRank


I'm [MB], a PhD student at the University [...] in Italy.

I'm currently involved in a project that requires using the Wikipedia database to compute PageRank and for other tasks, so I ran across your code. First of all, I'd like to thank you: it's very well written and works just fine!

I'd like to ask you if and how can I incorporate your code in my project. I'd like to use it because I need something to parse the SQL files of Wikipedia efficiently in Java and it seems that your code fits perfectly well - plus, the fact that the PageRank is already done, is a big plus for me. Other than the PageRank, I'll use it to exploit the internal category structure of Wikipedia to build a simple recommender based on pointwise entropy.

Last but not least, I'd like to suggest you a couple of corrections: now, the number of columns of the page and pagelinks tables is respectively 4 and 13, so you have to correct and accordingly. Moreover, now the pagelinks table allows to track the namespace of the starting page, so it may be useful to limit the algorithm to run only on links going from namespace 0 to namespace 0. In fact, now the most important pages (as ranked by your algorithm) are Help:Searching, Wikilink and Hyperlink, which are all non-encyclopedic voices.

Thanks for your time,


from Simon K

Subject line: Fourier Transformation in x86 Assembly

Dear Nayuki,

Intrigued by Assembly language, I've took it upon myself to write an x86 implementation of the DFT. I was inspired by your blog posts, and your own implementation. Even though the result ended up being slower than the C/C++ implementation, I believe it was still a good attempt.

If you could take a look at it, I would be honored!

Anyhow, you're also very busy I presume, so if you can't find the time, I'd still like to thank you for your blogging endeavours. I especially like the mathematical side of it.

Best regards,

from EM

Subject line: Manufactoria solution


Thanks for making the webpage with all the Manufactoria solutions!  I don't know if you are interested, but I found a solution for the Robomecha! level on Manufactoria (level 28 by your count) that uses only 27 parts as opposed to your 33.  I've attached a screenshot of the solution, so feel free to use it if you want.


from MP

Subject line: Permission to use your code

Hi Nayuki,

I am an student studying programming and i would like to use your fast matrix Fibonacci method for my school project. The reason for that is, that it is faster then what came to my mind on my own. Could I get your permission to use it? The project was to calculate an array of integers into Fibonacci using, add them into one integer and then translate that into words. Just for the sake of clarity I will send you the code. If you disagree with my usage of your code, then I will just use the slow algorithm that my noggin could muster up.

Best regards

from EB

Subject line: Photo Permission Request

Hi Nayuki,

Do you mind if I use your laser image from Flickr for a blog post? Unless you prefer different attribution, I would credit you at the bottom as follows:

Nayuki Minase / Flickr

The blog isn't launched yet; otherwise I would show you an example. But it would just be your image in the middle of the copy to illustrate a subhead describing [...].


PS - Also, a personal thanks for your work pushing forward Bitcoin and cryptocurrency projects.

[EB] | [job title]
[email] | [telephone]

from S

Subject line: question about sha256 performance


I enjoyed your SHA256 performance page [1] a lot. I tried out the code on a recent i7 Macbook Pro and got 218.1 MiB/s for the fastest C algorithm. However, when I ran 4 test processes simultaneously then figure drops to about 176 MiB/s per process. Have you explored why this is? It would make for a very interesting article. And it would also be useful in future to determine performance on a single core, *and* on multiple cores in case different implementations behave differently in terms of performance on multiple cores?

Also, could you change your website so that I can somehow subscribe to your articles and get a notification when new articles are posted?

Thanks and greetings from Vancouver,


from SM

Subject line: Regarding Fast fibonacci

Hi Nayuki,

I am really impressed by your recent article on finding fibonacci numbers.

I want to use this in an open source BSD licensed project called SymPy. It's a computer algebra system.

What should I do to give a proper citation?



from EH

Subject line: Chemical Equation Balancer Liscensing

Dear Nayuki,

I am a 15 year old student at a high school in Cincinnati, Ohio. I am contacting you to request a licence for your Javascript file you've written (which by the way, is genius!) that balances chemical equations. I am currently taking chemistry/physical science, and my teacher thought it would be cool to have an app that for our phones that could balance chemical equations, and do other stuff (ex. display a periodic table). I started working on the app, but am requesting permission from you to purchase it on the Google Play Store. I will not run ads through the app, and i will clearly display throughout the app that the script is yours. No money will be made off of this, and mainly students in my classes will be using it, along with teachers, etc. If you need a working preview, which by the way, is no where close to being done (design, tools, etc), you can check out this HTML document here:[...]

I am more than able to change where the credit is given (what it says) and can even link back to your site is needed. Thank you for your time in reading this message, and your work is absolutely great. I really admire it and again, I thank you for your time.


from GK

Subject line: smallest enclosing circle

Hi Nayuki,

My name is [GK] and I work as a post-doc in the field of [...]. I'm from England but currently based in Japan.

I wanted to let you know that I used your free software 'smallest enclosing circle' in a recent project. It turns out that [...] is related to the smallest enclosing circled of [...]. So I found your code useful in some numerical work that I needed.

My paper is available at[...] (a preprint server). I currently cite your website in the references of the supplementary information (attached).

I wanted to check if there was any further information you would like me to add in the reference? I will be submitting the manuscript to [...] soon.

Best wishes


from PR

Subject line: Montgomery algorithm

Hi Nayuki,

I was looking at your Montgomery reduction code. I appreciate the work you have done and loved the way in which you have written. I tried similar type of implementation for RSA in python earlier but was facing some issues with big numbers. I think I need to make changes with the size of integers. I like your work and thanks for sharing the code. Keep coding J

Thanks & Regards,
Electrical and Computer Engineering
[American] University

from BS

Subject line: Javascript Triangle Solver

Hey, I’m a 10th Grade student from [school name] in South Carolina and I’m currently taking Trig/Precal. I’m working on a Triangle solver in java and  was looking into different ways of doing this. I found your javascript triangle solver and was wondering if I could port it to java and add it to my Java Calculator. This is not for a class assignment or anything I just felt like it would be fun to port this and create a Java swing GUI along with it. I will not be distributing the code or any compiled version of the program, I simply want to do this for the experience and to check my own answers.

Thank you,

from NP

Subject line: question about netpersec application.

Dear Mr. Nayuki,

Your application is really helping me on my studies.

I would appreciate it if you could help me with the following issue,
I installed netpersec (version 20140109) on an 64-bit Windows 7 Laptop and tried to use it on a network that theoretically can support downlink speeds up to 300Mpbs. But unfortunately as DL speed increases netpersec freezes (refreshing data very slow, almost once per 30sec). I tried various sampling rate settings but still nothing.

What might be the possible case of this behaviour?
Will 64-bit version be available sometime in the future?

thank you in advance.



from RC

Subject line: Consultation Work

I request a spreadsheet of either Speck or Simon cipher internals.

Given the relative simplicity of the round function and key schedule and lack of fiddling around with S-boxes, I think $25 would be reasonable.

from PTD

Subject line: CRC Forcing

Hello Nayuki,

I have very much enjoyed your article on CRC-32 forcing.

I have two questions for you.

First, would you mind if I ported your code to NodeJS JavaScript and published the ported code repository to my GitHub? If not, how would you like me to handle licensing? I would certainly at a minimize recognize you in the credits and link back to your article.

Second, what is this portion of your main1() code doing? I think I understand that you’re first checking to make sure args[2] is not greater than 32 bits. But, what is the second Integer.reverse doing? Why do you need to reverse the bits of args[2]?

long temp = Long.parseLong(args[2], 16);

if ((temp & 0xFFFFFFFFL) != temp)
   return "Error: Invalid new CRC-32 value";
newCrc = Integer.reverse((int)temp);

[telephone number]

"'You’ve got to choose between happiness and what people used to call high art. We’ve sacrificed the high art.'" -- "Brave New World", Aldous Huxley

from GB

Subject line: [...] – Research Project

Dear Nayuki:

My name is [G], and I am a junior in highschool enrolled at the [school name]. Note that I began coding (in Java) this year, and I found your website of help during my research project development. Thank you for your clear explanations! ☺

As a part of our school curriculum, we have to complete a STEM (Science, Technology, Engineering, and Math) project. My project deals with [...].

A part of my project includes a searching algorithm that can find [...] through an exhaustive search. I needed a way to generate the next lexicographically smallest permutation of an array, and I stumbled upon your solution. Without it, my algorithm would not properly function. Currently, I am in the process of writing my report for the upcoming science fair, but I would like to publish my research paper too. Without a doubt, I will cite your algorithm that I have used in my code, but I wanted to double check with you too. Is it okay if I use this?

I would be happy to send you a copy of my paper once it is finished. If you have any experience with [...], I would be interested in telling you a little bit more about my project, so that I could hopefully receive some expert feedback.

Thank you for your consideration,


from MM

Subject line: Book recommendations

Hello Nayuki, I stumbled across your website and I am really impressed with your work and blog posts. You seem to understand computer science and mathematics very well and was hoping if you could recommend some beginner books on those topics that you have read and has made you a better programmer. I'm interested in getting in to the mathematical side of things but don't know where to start.


from ST

Subject line: Donation for help with a personal problem

Hello! I found your page with the SHA256 implementation in C. I played around with it and found it had much better performance than the SHA256 implementation I'd been using in a C++ project previously.

I got it working for my purposes by tweaking your source and compiling in C, however, when I then took that implementation into my larger C++ project I'm encountering errors. After beating my head against cast conversions for a few hours, I thought I'd offer to offer a sum to you for your help. Let me know what you'd charge for help with the below, and what your paypal address is - I'll shoot you the money before I expected your answer. I can pay in bitcoin as well, however that would require a lot more effort on my end to get some, so paypal would be preferred.

The problem:

Ideally I want the below to work, taking in a string as input, then hashing it and returning as a string for the output:

std::string h(std::string inputtohash) {
   //return sha256(inputtohash);
   const uint8_t *message = (const uint8_t)inputtohash;
   uint32_t hash[8];
   sha256_hash(message, strlen((const char *)message), hash);

   char output[32];
   sprintf(output, "%08x%08x%08x%08x%08x%08x%08x%08x", hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7]);

   return output;

The 3rd line works in C when I pass it a literal string like the below:

const uint8_t *message = "foo";

However the same code gives me an error in C++ when I try to convert from std::string to const uint8_t. I've tried all sorts of approaches similar to the above to re-cast it, but all have failed. The exact implementation I have in the h() sample above returns the following in VC++:

Error    4    error C2440: 'type cast' : cannot convert from 'std::string' to 'uint8_t'

Let me know if you're up to help, and how much you'd charge for your time.



from DSMB

Subject line: CRC32 article feedback

Nayuki, I read your article on methods for forcing the CRC32 of a file and found it very interesting. It's frightening how trivial it is for a casual user to do.

Because I respect your thoroughness, I'm curious of your opinion whether this or a similar method could be used for forcing a SHA-256 hash?

from DS

Subject line: Copyrighted Work Permission Request


I was searching the internet earlier tonight for a good example of a Caesar-shift script in JavaScript and came across yours. I was just wondering if I could use a modified version of it on my personal website? Originally, I was looking for a way to cloak a contact email address from bots and screen scrapers but would still allow people to click the "mailto:" link. I figured the best way would be to do some a simple encryption on the address, then decrypt it on mouseOver().

I've attached a simple demo of the modified code that would be used, although I would probably make an improved version if I get your permission. The improved version would have at least the following to improve modularity:

  • Support for more characters (Unicode characters 32-64,90-97,etc.)
  • Optional verbose mode with console logging for debugging.
  • More parameters (input string, iterations)
  • Clearer encrypt/decrypt mode terminology

Hopefully that's okay with you-it seems like a pretty fun project for one of these nights.

Thanks for your time,

from SF

Subject line: Fullscreen Clock

Hey there,

last night I looked for a fullscreen clock to celebrate sylvester and found your implementation.

Today I made a tiny change to have it ajust to the window width on its own. Thought maybe you'ld like to know, since it's your code ...

Happy New Year,