Questions tagged [canonicalization]

is a process for converting data that has more than one possible representation into a "standard", "normal", or canonical form.

As per Wikipedia:

In computer science, canonicalization (abbreviated c14n, where 14 represents the number of letters between the C and the N; also sometimes standardization or normalization) is a process for converting data that has more than one possible representation into a "standard", "normal", or canonical form. This can be done to compare different representations for equivalence, to count the number of distinct data structures, to improve the efficiency of various algorithms by eliminating repeated calculations, or to make it possible to impose a meaningful sorting order.

180 questions
58
votes
7 answers

How to cryptographically hash a JSON object?

The following question is more complex than it may first seem. Assume that I've got an arbitrary JSON object, one that may contain any amount of data including other nested JSON objects. What I want is a cryptographic hash/digest of the JSON data,…
Jason Nichols
  • 11,063
  • 4
  • 31
  • 52
20
votes
2 answers

my ideal cache using guava

Off and on for the past few weeks I've been trying to find my ideal cache implementation using guava's MapMaker. See my previous two questions here and here to follow my thought process. Taking what I've learned, my next attempt is going to ditch…
Paul Bellora
  • 51,514
  • 17
  • 127
  • 176
18
votes
2 answers

Java: XML canonicalization

What's the easiest way to make a canonical form of a XML file in Java? Do you have some done code for that? I've found several links on the net, like this, this, and this, but I can't make it to work :/ Thanks, Ivan EDIT: I used the canonicalizer…
Ivan
  • 487
  • 3
  • 8
  • 20
16
votes
6 answers

Rejecting isomorphisms from collection of graphs

I have a collection of 15M (Million) DAGs (directed acyclic graphs - directed hypercubes actually) that I would like to remove isomorphisms from. What is the common algorithm for this? Each graph is fairly small, a hybercube of dimension N where N…
SwimBikeRun
  • 3,456
  • 9
  • 42
  • 73
12
votes
1 answer

How to implement a canonicalizing mapping in Java?

I am currently rolling my own little ORM, and find myself faced with the task of creating a canonicalizing mapping in order to prevent loading the same entity from the database more than once. My current approach is to use a HashMap
Björn Pollex
  • 70,106
  • 28
  • 177
  • 265
12
votes
6 answers

Alternative to 'realpath' to resolve "../" and "./" in a path

realpath does what I need, but only works if the files in the path actually exist. I need a function which returns a normalized path from a string (e.g. ../some/./directory/a/b/c/../d to some/directory/a/b/d), regardless of whether the…
Silverlan
  • 2,447
  • 2
  • 20
  • 55
11
votes
4 answers

Generating an XML document hash in C#

What's the best way to go about hashing an XML document in C#? I'd like to hash an XML document so that I can tell if it was manually changed from when it was generated. I'm not using this for security--it's OK if someone changes the XML, and…
M. Dudley
  • 26,519
  • 30
  • 137
  • 228
9
votes
4 answers

What does Canonical Representation mean and its potential vulnerability to websites

I searched on google for a meaning of canonical representation and turned up documents that are entirely too cryptic. Can anyone provide a quick explanation of canonical representation and also what are some typical vulnerabilities in websites to…
user130532
7
votes
2 answers

Canonical representation of a BigDecimal

What is the simplest way to reduce a Java BigDecimal containing an arbitrary value to a canonical form so that two BigDecimal's representing the same number will compare equal using the equals() method? I am parsing my numbers from arbitrary strings…
0xbe5077ed
  • 4,217
  • 1
  • 28
  • 62
6
votes
2 answers

Windows: How to canonicalize a file to the special folder?

i want to to persist some filenames for the user (e.g. recent files). Let's use six example files: c:\Documents & Settings\Ian\My Documents\Budget.xls c:\Documents & Settings\Ian\My Documents\My Pictures\Daughter's Winning Goal.jpg c:\Documents &…
Ian Boyd
  • 220,884
  • 228
  • 805
  • 1,125
6
votes
1 answer

Proper XML Canonicalization for SAML

I am running into the problem with validating the signature for the SAML 2.0 Assertion XML. I am using the SAML2 library from simpleSAMLphp project, which in turn is using the PHP xmlseclibs library for signing XML and verifying the signatures. I…
obaranovsky
  • 165
  • 7
5
votes
1 answer

May a C++ compiler normalize Unicode identifiers?

In C++, we can use a wide variety of Unicode characters in identifiers. For example, you could name a variable résumé. Those accented es can be represented in different ways: either as a precomposed character or as a plain e with a combining accent…
5
votes
4 answers

Canonical tags and UTF8

Would the following 2 canonical link tags be viewed by spiders as pointing to the same URL? - encoded - unencoded
Sam
  • 4,217
  • 11
  • 38
  • 59
5
votes
4 answers

How To Use XmlDsigC14NTransform Class in C#

I am trying to canonicalize an xml node by using System.Security.Cryptography.Xml.XMLDsigC14nTransform class of c# .net Framework 2.0. The instance expects three different input types, NodeList, Stream and XMLDocument. I try the transform with all…
artsince
  • 984
  • 17
  • 36
5
votes
2 answers

How to get canonicalized path (realpath) of nonexistent file in PHP?

script.php $filename = realpath(sprintf("%s/%s", getcwd(), $argv[1])); var_dump($filename); Let's try some things [/foo/bar/bof] $ php script.php ../foo.txt string(16) "/foo/bar/foo.txt" [/foo/bar/bof] $ php script.php…
Thank you
  • 107,507
  • 28
  • 191
  • 224
1
2 3
11 12