Search found 104 matches

by Magialisk
27 May 2014 14:04
Forum: DOS Batch Forum
Topic: FINDSTR exclusion pattern does not work. Backslashes prob
Replies: 14
Views: 15026

Re: FINDSTR exclusion pattern does not work. Backslashes pro

I wish I had my own crazy findstr examples with me here at home. I'll have to grab them from my work PC and see if you guys can make any sense of it... One of them was that there were two characters that seemed to be related, lets say the colon and the semicolon for example. If I told findtr to mat...
by Magialisk
10 May 2014 09:05
Forum: DOS Batch Forum
Topic: MD5 Message-Digest Algorithm
Replies: 21
Views: 24844

Re: MD5 Message-Digest Algorithm

I myself was quite confused about whether the limitation of cmd's signed ints was going to cause a problem since all of the addition in MD5 (anything written as '+' in the algorithm) is actually defined as addition modulo 2^32 on an unsigned integer. At first I didn't think that this would work prop...
by Magialisk
09 May 2014 00:32
Forum: DOS Batch Forum
Topic: MD5 Message-Digest Algorithm
Replies: 21
Views: 24844

Re: MD5 Message-Digest Algorithm

Einstein that code is insane! I can't even understand what it does anymore As you stated, the timing improvement is quite large so far. Tests 1-5 in the test suite run in 11-16ms, down from Aacini's 15-19 ms. Tests 6 and 7 run in 18-21 ms instead of 27-28 ms. The test of a 1K file came down from 1.4...
by Magialisk
04 May 2014 09:22
Forum: DOS Batch Forum
Topic: MD5 Message-Digest Algorithm
Replies: 21
Views: 24844

Re: MD5 Message-Digest Algorithm

Sorry I overlooked your question einstein. I didn't quite understand it the first time I guess, but I do now. In fact this same discussion came up after posting my AES code. With just about any algorithm there is going to be a way to calculate numbers directly instead of using a lookup table, and th...
by Magialisk
04 May 2014 00:10
Forum: DOS Batch Forum
Topic: MD5 Message-Digest Algorithm
Replies: 21
Views: 24844

Re: MD5 Message-Digest Algorithm

Well I hate to double post but I couldn't stand the wait before testing out the suggestions and posting back. First I looked over Aacini's code and when I hit this one line I just about fell off my chair: set /a "rShiftAmt=32-Shift[%%i], tempB=((X & 0x7FFFFFFF)>>rShiftAmt) + (1<<(31-rShiftA...
by Magialisk
03 May 2014 23:35
Forum: DOS Batch Forum
Topic: FINDSTR exclusion pattern does not work. Backslashes prob
Replies: 14
Views: 15026

Re: FINDSTR exclusion pattern does not work. Backslashes pro

I wish I had my own crazy findstr example with me here at home. I'll have to grab it from my work PC and see if you guys can make any sense of it... I had a findstr sequence that was intended to test a string for special characters. Of course it needed various escaping for some of them, but after a ...
by Magialisk
03 May 2014 22:57
Forum: DOS Batch Forum
Topic: MD5 Message-Digest Algorithm
Replies: 21
Views: 24844

Re: MD5 Message-Digest Algorithm

Wow! Imagine my surprise to come back here after only one night and see such enthusiastic responses to my post. Thank you all for the suggestions so far! I will give them all a try in the next couple of days and report back where any performance improvements were realized. einstein I'm intrigued by ...
by Magialisk
02 May 2014 22:58
Forum: DOS Batch Forum
Topic: MD5 Message-Digest Algorithm
Replies: 21
Views: 24844

MD5 Message-Digest Algorithm

Good evening all. Since I got some great feedback last time on my implementation of AES encryption in batch, I thought I'd post here my latest crypto-related development. This one implements the common MD5 hashing algorithm, also known as RFC 1321: m. This is a cryptographically secure* one-way hash...
by Magialisk
02 May 2014 13:44
Forum: DOS Batch Forum
Topic: Bi-directional access to lookup tables
Replies: 2
Views: 3820

Re: Bi-directional access to lookup tables

When it's a small number of elements I've done what you described first, a second table with the pairs inverted. It's not fancy, but it works well, and that way the code that extracts the data from the map can be identical. The alternate method you propose is nice because you don't have to declare t...
by Magialisk
29 Apr 2014 23:12
Forum: DOS Batch Forum
Topic: typeperf commands in batch script issue
Replies: 2
Views: 4816

Re: typeperf commands in batch script issue

Quick and dirty as is my usual style, but I believe this does what you're looking for. Just tweak the file names I created to suit your liking. @echo off setlocal enabledelayedexpansion :: Get input value and define default interval if none provided set time_interval=%~1 IF "%time_interval%&quo...
by Magialisk
28 Apr 2014 23:17
Forum: DOS Batch Forum
Topic: Please help - analize batch results and reboot if required.
Replies: 7
Views: 6938

Re: Please help - analize batch results and reboot if requir

No problem Dave. For what it's worth Foxi's does the exact same thing as mine, just in a more compact and efficient manner. I spelled it out in a potentially more readable form, but there's really no difference in the end. Well, that and the fact that I took an artistic liberty in assuming that the ...
by Magialisk
22 Apr 2014 22:27
Forum: DOS Batch Forum
Topic: Please help - analize batch results and reboot if required.
Replies: 7
Views: 6938

Re: Please help - analize batch results and reboot if requir

Ahh yes the conditional/ternary style execution. I never got into the 'xxx && yyy || zzz' style but it sure is a lot nicer than my quick and dirty approach I was expecting someone to come drop in a 1-2 liner to solve this. Thanks foxidrive. Also, I was assuming that the number 37 might chang...
by Magialisk
21 Apr 2014 23:41
Forum: DOS Batch Forum
Topic: Please help - analize batch results and reboot if required.
Replies: 7
Views: 6938

Re: Please help - analize batch results and reboot if requir

This is as quick and dirty as it gets, but it should get you started: @echo off SETLOCAL ENABLEDELAYEDEXPANSION FOR /F "tokens=*" %%a IN ('"devcon status *VEN_DADA*"') do ( echo "%%a" | find "The device has the following problem:" >nul IF !ERRORLEVEL!==0 ( ech...
by Magialisk
19 Apr 2014 18:16
Forum: DOS Batch Forum
Topic: problem with set and multi-line comment in macros
Replies: 7
Views: 7975

Re: problem with set and multi-line comment in macros

That is good thinking, nice use of a null to stop the parser from confusing digits for streams. The only minor nitpick I'd have is that the idea behind jeb's new comment style was including comments in a macro without increasing it's size. In fact I remember reading posts where everyone was going ba...
by Magialisk
16 Apr 2014 23:41
Forum: DOS Batch Forum
Topic: problem with set and multi-line comment in macros
Replies: 7
Views: 7975

Re: problem with set and multi-line comment in macros

Ah yes it is now much clearer what you're trying to do and what the problem was exactly. I completely overlooked the relationship to jeb's new macro commenting style. I'm still not 100% clear on your statement about "altering how the data gets set". Adding a caret to your last failed test ...