Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modulus operator conspicuously missing #43

Closed
plusvic opened this issue Nov 24, 2013 · 2 comments
Closed

Modulus operator conspicuously missing #43

plusvic opened this issue Nov 24, 2013 · 2 comments

Comments

@plusvic
Copy link
Member

plusvic commented Nov 24, 2013

From juliavi...@gmail.com on April 27, 2012 01:32:10

Currently, Yara v1.6 supports Addition, Subtraction, Multiplication, and Division (+,-,,) However, modular division is not supported. This isn't a huge problem, because you can just do something like: X - (n(X/n)) rather than just writing X%n, but the later is easier to read...

For example, to verify the check-bits on a zlib stream, you'd currently need to write something like this:

0 == ((uint8(0)<<8)|uint8(1)) - ( 31 * (((uint8(0)<<8)|uint8(1))\31))

With a native modulus operator in the Yara syntax, you could just write:

0 == (uint8(0)<<8)|uint8(1)) % 31

With support for big-endian WORDs and DWORDs (See: Issue #38 ) this could be written simply as:

0 == uintb16(0) % 31

// .. or however the syntax would look. Something like pack() and unpack() from Perl and Python would be good for exactly specifying types.

Original issue: http://code.google.com/p/yara-project/issues/detail?id=43

@plusvic
Copy link
Member Author

plusvic commented Nov 24, 2013

From juliavi...@gmail.com on July 03, 2012 21:18:52

I've added a patch for this, attached to issue 54 .

@plusvic
Copy link
Member Author

plusvic commented Nov 24, 2013

From plus...@gmail.com on August 15, 2012 08:40:18

Fixed in r154 . See issue 54 .

Status: Fixed

@plusvic plusvic closed this as completed Nov 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant