Using references from the shell?

Erik Reitsma EJ (RY/ETM) <>
Wed Aug 20 16:42:54 CEST 2003


> As far as I understand, the whole point of references is that they are
> unforgeable.  If there existed a way to obtain the reference from
> its printed representation then this would be vanified.

You can still do:
1> R=make_ref().
#Ref<0.0.0.102>
2> B=term_to_binary(R).
<<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0,
0,102,0,0,0,0,...>>
3> io:format("~w~n",[B]).
<<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0,
0,102,0,0,0,0,0,0,0,0>>
ok
4> BCopy = <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115
,116,0,0,0,0,102,0,0,0,0,0,0,0,0>>.
<<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0,
0,102,0,0,0,0,...>>
5> R2=binary_to_term(BCopy).
#Ref<0.0.0.102>
6> R==R2.
true
7> 

So I do not know what you mean by "forging", but I can create my own references in this way.

*Erik.




More information about the erlang-questions mailing list