bib_search
is a simple CLI utility to parse and query large .bib
files. I created it in order to work efficiently with
the crypto.bib file. This file contains almost all the most important publications in
cryptoqraphy since the 90’s. This file is relatively big for a .bib
file and is slow to use as is with biber.
My tool has two aims:
The CLI is written in rust and can be installed with cargo. The command line to install the tool is:
cargo install --git https://github.com/rloic/bib_search
The CLI has the following signature:
bib_search
USAGE:
bib_search [OPTIONS] [--] [filenames]...
ARGS:
<filenames>...
OPTIONS:
-c, --count Print the number of founded entries at the end of the search
-d, --decreasing Sort the entries by descending date
-h, --help Print help information
-q, --query <queries>... The queries
-t, --tabular Display the entries in tabular form
bib_search
can be used on files or piped with other processes.
# Example with a local file
# curl https://cryptobib.di.ens.fr/cryptobib/static/files/crypto_crossref.bib -o crypto.bib
bib_search crypto.bib -d -q "c:aes&howpublished:NIST"
will print:
@Misc{AES,
howpublished = "National Institute of Standards and Technology, {NIST FIPS PUB} 197, {U.S.} Department of Commerce",
key = "AES",
month = nov,
title = "{Advanced} {Encryption} {Standard} ({AES})",
year = 2001,
}
The same command can be used with pipes:
curl -s https://cryptobib.di.ens.fr/cryptobib/static/files/crypto_crossref.bib | bib_search -q "c:aes&howpublished:NIST"
The queries are in the form: FIELD:VALUE(&FIELD:VALUE)*
. The FIELD can be any bibtex field name: title
, author
, etc. The VALUE
can be any string (excepted the character &
which is used to separate the conditions).
The queries try to remove the accents and the capitalization of the bibtex file, thus the queries: c:aes&howpublished:NIST
and c:AES&howpublished:nist
will return the same results. If you cannot find an entry with querying the full title try to omit the parts
that contains accents.
Some shortcuts are available:
Shortcut | Equivalent Field |
---|---|
t | title |
y | year |
a | author |
c | citation key |
p | publisher |
It is also possible to forbid entries by adding !
before the FIELD
, e.g. '!c:eprint'
will remove the eprint entries.
The special field *
allows to match content in any field.
# Search of papers with authors Daemen and Rijmen which are not ePrints.
bib_search crypto.bib -t -q 'a:daemen&a:rijmen&!c:eprint'
+---------------+--------------------+------------------------------------------+------------------+------+
+ Type + Cite key + Title + Author(s) + Year +
+---------------+--------------------+------------------------------------------+------------------+------+
| InProceedings | FSE:RDPBD96 | The Cipher {SHARK} | Vincent Rijmen | 1996 |
| | | | Joan Daemen | |
| | | | Bart Preneel | |
| | | | Anton Bossalaers | |
| | | | Erik {De Win} | |
+---------------+--------------------+------------------------------------------+------------------+------+
| InProceedings | FSE:DaeKnuRij97 | The Block Cipher {Square} | Joan Daemen | 1997 |
| | | | Lars R. Knudsen | |
| | | | Vincent Rijmen | |
+---------------+--------------------+------------------------------------------+------------------+------+
| InProceedings | IMA:DaeRij01 | The Wide Trail Design Strategy | Joan Daemen | 2001 |
| | | | Vincent Rijmen | |
+---------------+--------------------+------------------------------------------+------------------+------+
| InProceedings | EC:DaeRij02 | {AES} and the Wide Trail Design | Joan Daemen | 2002 |
| | | Strategy (Invited Talk) | Vincent Rijmen | |
+---------------+--------------------+------------------------------------------+------------------+------+
| InProceedings | INDOCRYPT:DaeRij02 | Security of a Wide Trail Design | Joan Daemen | 2002 |
| | | (Invited Talk) | Vincent Rijmen | |
+---------------+--------------------+------------------------------------------+------------------+------+
| InProceedings | FSE:DaeRij05 | A New {MAC} Construction {ALRED} and a | Joan Daemen | 2005 |
| | | Specific Instance {ALPHA}-{MAC} | Vincent Rijmen | |
+---------------+--------------------+------------------------------------------+------------------+------+
| InProceedings | SCN:DaeRij06 | Understanding Two-Round Differentials | Joan Daemen | 2006 |
| | | in {AES} | Vincent Rijmen | |
+---------------+--------------------+------------------------------------------+------------------+------+
My solution allows to easily query large (30 MB) bibtex file. It takes around .5 seconds to query and display the solutions on the crypto.bib file.